MCPcopy Create free account
hub / github.com/Synzack/ldapper / getObjectAndInheritedType

Function getObjectAndInheritedType

SecurityDescriptor/SecurityDescriptorFuncs.go:74–115  ·  view source on GitHub ↗
(ACE string, ACEFlags string)

Source from the content-addressed store, hash-verified

72}
73
74func getObjectAndInheritedType(ACE string, ACEFlags string) (objectTypeGUID string, inheritedObjectTypeGUID string) {
75 //ObjectType field existent
76 if ACEFlags == "00000001" {
77 objectType := ACE[24:56]
78 portion1 := endianConvert(objectType[0:8])
79 portion2 := endianConvert(objectType[8:12])
80 portion3 := endianConvert(objectType[12:16])
81 portion4 := objectType[16:20]
82 portion5 := objectType[20:]
83 objectTypeGUID = fmt.Sprintf("%s-%s-%s-%s-%s", portion1, portion2, portion3, portion4, portion5)
84 inheritedObjectTypeGUID = ""
85 //InheritedObjectType field existent
86 } else if ACEFlags == "00000002" {
87 inheritedObjectType := ACE[24:56]
88 portion1 := endianConvert(inheritedObjectType[0:8])
89 portion2 := endianConvert(inheritedObjectType[8:12])
90 portion3 := endianConvert(inheritedObjectType[12:16])
91 portion4 := inheritedObjectType[16:20]
92 portion5 := inheritedObjectType[20:]
93 inheritedObjectTypeGUID = fmt.Sprintf("%s-%s-%s-%s-%s", portion1, portion2, portion3, portion4, portion5)
94 objectTypeGUID = ""
95 //Both fields existent
96 } else if ACEFlags == "00000003" {
97 objectType := ACE[24:56]
98 portion1 := endianConvert(objectType[0:8])
99 portion2 := endianConvert(objectType[8:12])
100 portion3 := endianConvert(objectType[12:16])
101 portion4 := objectType[16:20]
102 portion5 := objectType[20:]
103 objectTypeGUID = fmt.Sprintf("%s-%s-%s-%s-%s", portion1, portion2, portion3, portion4, portion5)
104
105 inheritedObjectType := ACE[56:88]
106 portion1 = endianConvert(inheritedObjectType[0:8])
107 portion2 = endianConvert(inheritedObjectType[8:12])
108 portion3 = endianConvert(inheritedObjectType[12:16])
109 portion4 = inheritedObjectType[16:20]
110 portion5 = inheritedObjectType[20:]
111 inheritedObjectTypeGUID = fmt.Sprintf("%s-%s-%s-%s-%s", portion1, portion2, portion3, portion4, portion5)
112 }
113
114 return
115}
116
117func endianConvert(sd string) (newSD string) {
118 sdBytes, _ := hex.DecodeString(sd)

Callers 1

parseMethod · 0.85

Calls 1

endianConvertFunction · 0.85

Tested by

no test coverage detected