* 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>
|
2004-02-09 Ralf Habacker <ralf.habacker@freenet.de>
|
||||||
|
|
||||||
* fhandler_socket.cc (fhandler_socket::ioctl): Add FIONREAD handling.
|
* 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;
|
security_descriptor sd;
|
||||||
PSECURITY_DESCRIPTOR psd = NULL;
|
PSECURITY_DESCRIPTOR psd = NULL;
|
||||||
|
LONG ret;
|
||||||
|
|
||||||
if (object_type == SE_REGISTRY_KEY)
|
if (object_type == SE_REGISTRY_KEY)
|
||||||
{
|
{
|
||||||
/* use different code for registry handles, for performance reasons */
|
/* use different code for registry handles, for performance reasons */
|
||||||
DWORD len = 0;
|
DWORD len = 0;
|
||||||
if (RegGetKeySecurity ((HKEY) handle,
|
if ((ret = RegGetKeySecurity ((HKEY) handle,
|
||||||
DACL_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
|
||||||
| GROUP_SECURITY_INFORMATION
|
| GROUP_SECURITY_INFORMATION
|
||||||
| OWNER_SECURITY_INFORMATION,
|
| OWNER_SECURITY_INFORMATION,
|
||||||
sd, &len) != ERROR_INSUFFICIENT_BUFFER)
|
sd, &len)) != ERROR_INSUFFICIENT_BUFFER)
|
||||||
{
|
__seterrno_from_win_error (ret);
|
||||||
__seterrno ();
|
else if (!sd.malloc (len))
|
||||||
debug_printf ("RegGetKeySecurity %E");
|
|
||||||
}
|
|
||||||
if (!sd.malloc (len))
|
|
||||||
set_errno (ENOMEM);
|
set_errno (ENOMEM);
|
||||||
else if (RegGetKeySecurity ((HKEY) handle,
|
else if ((ret = RegGetKeySecurity ((HKEY) handle,
|
||||||
DACL_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
|
||||||
| GROUP_SECURITY_INFORMATION
|
| GROUP_SECURITY_INFORMATION
|
||||||
| OWNER_SECURITY_INFORMATION,
|
| OWNER_SECURITY_INFORMATION,
|
||||||
sd, &len) != ERROR_SUCCESS)
|
sd, &len)) != ERROR_SUCCESS)
|
||||||
{
|
__seterrno_from_win_error (ret);
|
||||||
__seterrno ();
|
else
|
||||||
debug_printf ("RegGetKeySecurity %E");
|
psd = sd;
|
||||||
}
|
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||||
get_info_from_sd (sd, 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
|
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);
|
get_info_from_sd (psd, attribute, uidret, gidret);
|
||||||
if (psd)
|
LocalFree (psd);
|
||||||
LocalFree (psd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user