@@ -45,9 +45,11 @@ import (
45
45
* Are they used for filesystem objects?
46
46
*/
47
47
const (
48
- SDDL_REVISION = 1 // SDDL Revision MUST always be 1.
49
- SID_REVISION = 1 // SID Revision MUST always be 1.
50
- ACL_REVISION = 2 // Higher ACL revisions support stuff like Object ACE.
48
+ SDDL_REVISION = 1 // SDDL Revision MUST always be 1.
49
+ SID_REVISION = 1 // SID Revision MUST always be 1.
50
+ ACL_REVISION = 2 // ACL revision for support basic ACE type used for filesystem ACLs.
51
+ ACL_REVISION_DS = 4 // ACL revision for supporting stuff like Object ACE. This should ideally not be used with the ACE
52
+ // types we support, but I've seen some objects like that.
51
53
)
52
54
53
55
type SECURITY_INFORMATION uint32
@@ -856,12 +858,16 @@ func aceRightsToString(aceRights uint32) string {
856
858
}
857
859
858
860
// Use stringified rights only if *all* available rights can be represented with a shorthand name.
861
+ // The else part is commented as it's being hit too often. One such common aceRights value is 0x1200a9.
859
862
if allRights == aceRights {
860
863
return aceRightsString
861
- } else if allRights != 0 {
862
- fmt .Printf ("aceRightsString: Only partial rights could be stringified (aceRights=0x%x, allRights=0x%x)" ,
863
- aceRights , allRights )
864
864
}
865
+ /*
866
+ else if allRights != 0 {
867
+ fmt.Printf("aceRightsString: Only partial rights could be stringified (aceRights=0x%x, allRights=0x%x)",
868
+ aceRights, allRights)
869
+ }
870
+ */
865
871
866
872
// Fallback to integral mask value.
867
873
return fmt .Sprintf ("0x%x" , aceRights )
@@ -1113,9 +1119,17 @@ func getDaclString(sd []byte) (string, error) {
1113
1119
1114
1120
// ACL.AclRevision.
1115
1121
aclRevision := sd [dacloffset ]
1116
- if aclRevision != ACL_REVISION {
1122
+
1123
+ //
1124
+ // Though we support only ACCESS_ALLOWED_ACE_TYPE and ACCESS_DENIED_ACE_TYPE which as per docs should be
1125
+ // present with ACL revision 2, but I've seen some objects with these ACE types but acl revision 4.
1126
+ // Instead of failing here, we let it proceed. Later isUnsupportedAceType() will catch unsupported ACE types.
1127
+ //
1128
+ // https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/20233ed8-a6c6-4097-aafa-dd545ed24428
1129
+ //
1130
+ if aclRevision != ACL_REVISION && aclRevision != ACL_REVISION_DS {
1117
1131
// More importantly we don't support Object ACEs (ACL_REVISION_DS).
1118
- return "" , fmt .Errorf ("Unsupported ACL Revision (%d), supported revision is %d " , aclRevision , ACL_REVISION )
1132
+ return "" , fmt .Errorf ("Invalid ACL Revision (%d), valid values are 2 and 4. " , aclRevision )
1119
1133
}
1120
1134
1121
1135
// ACL.AceCount.
0 commit comments