Skip to content

Commit f0529b7

Browse files
committed
Fix SDDL alias RO to map to Enterprise RODC RID 498 (Fixes #102)
1 parent 959d590 commit f0529b7

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

sddl/sid/sid.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var SDDLToSID = map[string]string{
5959
"SA": "S-1-5-21-0-0-0-518", // Schema Admins
6060
"EA": "S-1-5-21-0-0-0-519", // Enterprise Admins
6161
"PA": "S-1-5-21-0-0-0-520", // Group Policy Creator Owners
62-
"RO": "S-1-5-21-0-0-0-521", // Read-Only Domain Controllers
62+
"RO": "S-1-5-21-0-0-0-498", // Enterprise Read-Only Domain Controllers (SDDL_ENTERPRISE_RO_DCs)
6363
"CN": "S-1-5-21-0-0-0-522", // Cloneable Domain Controllers
6464
"RS": "S-1-5-21-0-0-0-553", // RAS Servers Group
6565

sddl/sid/sid_test.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,28 @@ import (
77
func TestSid(t *testing.T) {
88

99
}
10+
11+
// TestSDDLAlias_RO is a regression test for the SDDL alias "RO" mapping to the
12+
// wrong RID. Per the Microsoft SID Strings reference, "RO" is
13+
// SDDL_ENTERPRISE_RO_DCs (Enterprise Read-Only Domain Controllers),
14+
// DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS = 498. It was
15+
// previously mapped to 521 (the plain Read-Only Domain Controllers group,
16+
// which has no SDDL alias).
17+
func TestSDDLAlias_RO(t *testing.T) {
18+
const want = "S-1-5-21-0-0-0-498"
19+
20+
if got := SDDLToSID["RO"]; got != want {
21+
t.Errorf("SDDLToSID[\"RO\"] = %q, want %q", got, want)
22+
}
23+
24+
// The reverse mapping is derived from SDDLToSID, so it must resolve the
25+
// correct SID back to "RO".
26+
if got := SIDToSDDL[want]; got != "RO" {
27+
t.Errorf("SIDToSDDL[%q] = %q, want \"RO\"", want, got)
28+
}
29+
30+
// RID 521 must no longer be aliased to "RO".
31+
if got, ok := SIDToSDDL["S-1-5-21-0-0-0-521"]; ok && got == "RO" {
32+
t.Errorf("S-1-5-21-0-0-0-521 must not map to \"RO\" (it is the non-aliased Read-Only Domain Controllers group)")
33+
}
34+
}

0 commit comments

Comments
 (0)