* autoload.cc: added RegGetKeySecurity()
* security.cc (get_nt_object_attribute): use RegGetKeySecurity() for performance.
This commit is contained in:
parent
2f4be7367e
commit
98b36ec8ed
@ -1,3 +1,9 @@
|
|||||||
|
2003-03-27 Joe Buehler <jhpb@draco.hekimian.com>
|
||||||
|
|
||||||
|
* autoload.cc: added RegGetKeySecurity()
|
||||||
|
* security.cc (get_nt_object_attribute): use RegGetKeySecurity() for
|
||||||
|
performance.
|
||||||
|
|
||||||
2003-03-25 Christopher Faylor <cgf@redhat.com>
|
2003-03-25 Christopher Faylor <cgf@redhat.com>
|
||||||
Joe Buehler <jhpb@draco.hekimian.com>
|
Joe Buehler <jhpb@draco.hekimian.com>
|
||||||
|
|
||||||
|
@ -375,6 +375,7 @@ LoadDLLfunc (SetSecurityDescriptorDacl, 16, advapi32)
|
|||||||
LoadDLLfunc (SetSecurityDescriptorGroup, 12, advapi32)
|
LoadDLLfunc (SetSecurityDescriptorGroup, 12, advapi32)
|
||||||
LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32)
|
LoadDLLfunc (SetSecurityDescriptorOwner, 12, advapi32)
|
||||||
LoadDLLfunc (SetTokenInformation, 16, advapi32)
|
LoadDLLfunc (SetTokenInformation, 16, advapi32)
|
||||||
|
LoadDLLfunc (RegGetKeySecurity, 16, advapi32)
|
||||||
|
|
||||||
LoadDLLfunc (NetApiBufferFree, 4, netapi32)
|
LoadDLLfunc (NetApiBufferFree, 4, netapi32)
|
||||||
LoadDLLfuncEx (NetGetDCName, 12, netapi32, 1)
|
LoadDLLfuncEx (NetGetDCName, 12, netapi32, 1)
|
||||||
|
@ -1443,19 +1443,73 @@ get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type,
|
|||||||
PSECURITY_DESCRIPTOR psd = NULL;
|
PSECURITY_DESCRIPTOR psd = NULL;
|
||||||
cygpsid owner_sid;
|
cygpsid owner_sid;
|
||||||
cygpsid group_sid;
|
cygpsid group_sid;
|
||||||
PACL acl;
|
PACL acl = NULL;
|
||||||
|
|
||||||
if (ERROR_SUCCESS != GetSecurityInfo (handle, object_type,
|
if (object_type == SE_REGISTRY_KEY)
|
||||||
DACL_SECURITY_INFORMATION |
|
|
||||||
GROUP_SECURITY_INFORMATION |
|
|
||||||
OWNER_SECURITY_INFORMATION,
|
|
||||||
(PSID *) &owner_sid,
|
|
||||||
(PSID *) &group_sid,
|
|
||||||
&acl, NULL, &psd))
|
|
||||||
{
|
{
|
||||||
__seterrno ();
|
// use different code for registry handles, for performance reasons
|
||||||
debug_printf ("GetSecurityInfo %E");
|
char sd_buf[4096];
|
||||||
return -1;
|
PSECURITY_DESCRIPTOR psd2 = (PSECURITY_DESCRIPTOR) & sd_buf[0];
|
||||||
|
DWORD len = sizeof (sd_buf);
|
||||||
|
if (ERROR_SUCCESS != RegGetKeySecurity ((HKEY) handle,
|
||||||
|
DACL_SECURITY_INFORMATION |
|
||||||
|
GROUP_SECURITY_INFORMATION |
|
||||||
|
OWNER_SECURITY_INFORMATION,
|
||||||
|
psd2, &len))
|
||||||
|
{
|
||||||
|
__seterrno ();
|
||||||
|
debug_printf ("RegGetKeySecurity %E");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL bDaclPresent;
|
||||||
|
BOOL bDaclDefaulted;
|
||||||
|
if (!GetSecurityDescriptorDacl (psd2,
|
||||||
|
&bDaclPresent, &acl, &bDaclDefaulted))
|
||||||
|
{
|
||||||
|
__seterrno ();
|
||||||
|
debug_printf ("GetSecurityDescriptorDacl %E");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!bDaclPresent)
|
||||||
|
{
|
||||||
|
acl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL bGroupDefaulted;
|
||||||
|
if (!GetSecurityDescriptorGroup (psd2,
|
||||||
|
(PSID *) & group_sid,
|
||||||
|
&bGroupDefaulted))
|
||||||
|
{
|
||||||
|
__seterrno ();
|
||||||
|
debug_printf ("GetSecurityDescriptorGroup %E");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL bOwnerDefaulted;
|
||||||
|
if (!GetSecurityDescriptorOwner (psd2,
|
||||||
|
(PSID *) & owner_sid,
|
||||||
|
&bOwnerDefaulted))
|
||||||
|
{
|
||||||
|
__seterrno ();
|
||||||
|
debug_printf ("GetSecurityDescriptorOwner %E");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ERROR_SUCCESS != GetSecurityInfo (handle, object_type,
|
||||||
|
DACL_SECURITY_INFORMATION |
|
||||||
|
GROUP_SECURITY_INFORMATION |
|
||||||
|
OWNER_SECURITY_INFORMATION,
|
||||||
|
(PSID *) & owner_sid,
|
||||||
|
(PSID *) & group_sid,
|
||||||
|
&acl, NULL, &psd))
|
||||||
|
{
|
||||||
|
__seterrno ();
|
||||||
|
debug_printf ("GetSecurityInfo %E");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__uid32_t uid;
|
__uid32_t uid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user