mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-30 02:50:25 +08:00
* security.cc (get_nt_object_attribute): Fix error handling.
This commit is contained in:
parent
6c6a052230
commit
897c785600
@ -1,3 +1,7 @@
|
||||
2004-02-11 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* security.cc (get_nt_object_attribute): Fix error handling.
|
||||
|
||||
2004-02-09 Ralf Habacker <ralf.habacker@freenet.de>
|
||||
|
||||
* fhandler_socket.cc (fhandler_socket::ioctl): Add FIONREAD handling.
|
||||
|
@ -1407,48 +1407,40 @@ get_nt_object_attribute (HANDLE handle, SE_OBJECT_TYPE object_type,
|
||||
{
|
||||
security_descriptor sd;
|
||||
PSECURITY_DESCRIPTOR psd = NULL;
|
||||
LONG ret;
|
||||
|
||||
if (object_type == SE_REGISTRY_KEY)
|
||||
{
|
||||
/* use different code for registry handles, for performance reasons */
|
||||
DWORD len = 0;
|
||||
if (RegGetKeySecurity ((HKEY) handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, &len) != ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
__seterrno ();
|
||||
debug_printf ("RegGetKeySecurity %E");
|
||||
}
|
||||
if (!sd.malloc (len))
|
||||
if ((ret = RegGetKeySecurity ((HKEY) handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, &len)) != ERROR_INSUFFICIENT_BUFFER)
|
||||
__seterrno_from_win_error (ret);
|
||||
else if (!sd.malloc (len))
|
||||
set_errno (ENOMEM);
|
||||
else if (RegGetKeySecurity ((HKEY) handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, &len) != ERROR_SUCCESS)
|
||||
{
|
||||
__seterrno ();
|
||||
debug_printf ("RegGetKeySecurity %E");
|
||||
}
|
||||
get_info_from_sd (sd, attribute, uidret, gidret);
|
||||
}
|
||||
else if ((ret = RegGetKeySecurity ((HKEY) handle,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
sd, &len)) != ERROR_SUCCESS)
|
||||
__seterrno_from_win_error (ret);
|
||||
else
|
||||
psd = sd;
|
||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||
}
|
||||
else if ((ret = GetSecurityInfo (handle, object_type,
|
||||
DACL_SECURITY_INFORMATION
|
||||
| GROUP_SECURITY_INFORMATION
|
||||
| OWNER_SECURITY_INFORMATION,
|
||||
NULL, NULL, NULL, NULL, &psd)))
|
||||
__seterrno_from_win_error (ret);
|
||||
else
|
||||
{
|
||||
if (ERROR_SUCCESS != GetSecurityInfo (handle, object_type,
|
||||
DACL_SECURITY_INFORMATION |
|
||||
GROUP_SECURITY_INFORMATION |
|
||||
OWNER_SECURITY_INFORMATION,
|
||||
NULL, NULL, NULL, NULL, &psd))
|
||||
{
|
||||
__seterrno ();
|
||||
debug_printf ("GetSecurityInfo %E");
|
||||
psd = NULL;
|
||||
}
|
||||
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||
if (psd)
|
||||
LocalFree (psd);
|
||||
LocalFree (psd);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user