Implement stubbed RtlSetControlSecurityDescriptor() to pass units tests
Paul Bryan Roberts
pbronline-wine at yahoo.co.uk
Thu Sep 25 12:33:10 CDT 2008
---
dlls/advapi32/tests/security.c | 33 ++++++++++++++++-----------------
dlls/ntdll/sec.c | 28 ++++++++++++++++++++++++++--
2 files changed, 42 insertions(+), 19 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index b3ae860..f7dd815 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -2498,27 +2498,26 @@ static void test_PrivateObjectSecurity(void)
return;
}
- todo_wine
- {
- ok(pConvertStringSecurityDescriptorToSecurityDescriptorA(
- "O:SY"
- "G:S-1-5-21-93476-23408-4576"
- "D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)"
- "S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)", SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n");
+ ok(pConvertStringSecurityDescriptorToSecurityDescriptorA(
+ "O:SY"
+ "G:S-1-5-21-93476-23408-4576"
+ "D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)"
+ "(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)"
+ "S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)",
+ SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n");
- test_SetSecurityDescriptorControl(sec);
+ test_SetSecurityDescriptorControl(sec);
- LocalFree(sec);
+ LocalFree(sec);
- ok(pConvertStringSecurityDescriptorToSecurityDescriptorA(
- "O:SY"
- "G:S-1-5-21-93476-23408-4576",
- SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n");
+ ok(pConvertStringSecurityDescriptorToSecurityDescriptorA(
+ "O:SY"
+ "G:S-1-5-21-93476-23408-4576",
+ SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n");
- test_SetSecurityDescriptorControl(sec);
+ test_SetSecurityDescriptorControl(sec);
- LocalFree(sec);
- }
+ LocalFree(sec);
ok(pConvertStringSecurityDescriptorToSecurityDescriptorA(
"O:SY"
@@ -2528,7 +2527,7 @@ static void test_PrivateObjectSecurity(void)
buf = HeapAlloc(GetProcessHeap(), 0, dwDescSize);
pSetSecurityDescriptorControl(sec, SE_DACL_PROTECTED, SE_DACL_PROTECTED);
GetSecurityDescriptorControl(sec, &ctrl, &dwRevision);
- todo_wine expect_eq(ctrl, 0x9014, int, "%x");
+ expect_eq(ctrl, 0x9014, int, "%x");
ok(GetPrivateObjectSecurity(sec, GROUP_SECURITY_INFORMATION, buf, dwDescSize, &retSize),
"GetPrivateObjectSecurity failed (err=%u)\n", GetLastError());
diff --git a/dlls/ntdll/sec.c b/dlls/ntdll/sec.c
index af3a138..90d3f88 100644
--- a/dlls/ntdll/sec.c
+++ b/dlls/ntdll/sec.c
@@ -1052,8 +1052,32 @@ NTSTATUS WINAPI RtlSetControlSecurityDescriptor(
SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest,
SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet)
{
- FIXME("(%p 0x%08x 0x%08x): stub\n", SecurityDescriptor, ControlBitsOfInterest,
- ControlBitsToSet);
+ SECURITY_DESCRIPTOR_CONTROL const immutable = SE_OWNER_DEFAULTED
+ | SE_GROUP_DEFAULTED
+ | SE_DACL_PRESENT
+ | SE_DACL_DEFAULTED
+ | SE_SACL_PRESENT
+ | SE_SACL_DEFAULTED
+ | SE_RM_CONTROL_VALID
+ | SE_SELF_RELATIVE
+ ;
+
+ SECURITY_DESCRIPTOR *lpsd = SecurityDescriptor;
+
+ TRACE("(%p 0x%04x 0x%04x)\n", SecurityDescriptor,
+ ControlBitsOfInterest, ControlBitsToSet);
+
+/* Until there is a conformance test that shows this to be correct */
+#if 0
+ if (lpsd->Revision != SECURITY_DESCRIPTOR_REVISION)
+ return STATUS_UNKNOWN_REVISION;
+#endif
+ if ((ControlBitsOfInterest | ControlBitsToSet) & immutable)
+ return STATUS_INVALID_PARAMETER;
+
+ lpsd->Control |= (ControlBitsOfInterest & ControlBitsToSet);
+ lpsd->Control &= ~(ControlBitsOfInterest & ~ControlBitsToSet);
+
return STATUS_SUCCESS;
}
--
1.5.4.3
--------------080406080706030400060404--
More information about the wine-patches
mailing list