forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sid.go
56 lines (49 loc) · 1.3 KB
/
sid.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package sys
import (
"fmt"
)
// SID represents the Windows Security Identifier for an account.
type SID struct {
Identifier string `xml:"UserID,attr"`
Name string
Domain string
Type SIDType
}
// String returns string representation of SID.
func (a SID) String() string {
return fmt.Sprintf("SID Identifier[%s] Name[%s] Domain[%s] Type[%s]",
a.Identifier, a.Name, a.Domain, a.Type)
}
// SIDType identifies the type of a security identifier (SID).
type SIDType uint32
// SIDType values.
const (
// Do not reorder.
SidTypeUser SIDType = 1 + iota
SidTypeGroup
SidTypeDomain
SidTypeAlias
SidTypeWellKnownGroup
SidTypeDeletedAccount
SidTypeInvalid
SidTypeUnknown
SidTypeComputer
SidTypeLabel
)
// sidTypeToString is a mapping of SID types to their string representations.
var sidTypeToString = map[SIDType]string{
SidTypeUser: "User",
SidTypeGroup: "Group",
SidTypeDomain: "Domain",
SidTypeAlias: "Alias",
SidTypeWellKnownGroup: "Well Known Group",
SidTypeDeletedAccount: "Deleted Account",
SidTypeInvalid: "Invalid",
SidTypeUnknown: "Unknown",
SidTypeComputer: "Computer",
SidTypeLabel: "Label",
}
// String returns string representation of SIDType.
func (st SIDType) String() string {
return sidTypeToString[st]
}