Partially revert change from 2006-10-22. GetSecurityInfo messes up

user information on NT4.
	* sec_helper.cc (security_descriptor::malloc): Drop LocalAlloc
	considerations.
	(security_descriptor::realloc): Ditto.
	(security_descriptor::free): Ditto.
	* security.cc (get_reg_security): Reinstantiate.
	(get_nt_object_security): Revert to using NtQuerySecurityObject.
	* security.h (class security_descriptor): Drop type member.
	Accommodate throughout.
	(security_descriptor::size): Constify.
	(security_descriptor::copy): Ditto.
This commit is contained in:
Corinna Vinschen
2006-12-20 17:14:23 +00:00
parent 24fa638dbd
commit 97b09fe1c5
4 changed files with 87 additions and 45 deletions

View File

@ -266,10 +266,7 @@ security_descriptor::malloc (size_t nsize)
{
free ();
if ((psd = (PSECURITY_DESCRIPTOR) ::malloc (nsize)))
{
sd_size = nsize;
type = malloced;
}
sd_size = nsize;
return psd;
}
@ -278,23 +275,9 @@ security_descriptor::realloc (size_t nsize)
{
PSECURITY_DESCRIPTOR tmp;
if (type == malloced)
{
if (!(tmp = (PSECURITY_DESCRIPTOR) ::realloc (psd, nsize)))
return NULL;
}
else
{
if (!(tmp = (PSECURITY_DESCRIPTOR) ::malloc (nsize)))
return NULL;
if (psd)
{
memcpy (tmp, psd, LocalSize (psd));
LocalFree (psd);
}
}
if (!(tmp = (PSECURITY_DESCRIPTOR) ::realloc (psd, nsize)))
return NULL;
sd_size = nsize;
type = malloced;
return psd = tmp;
}
@ -302,15 +285,9 @@ void
security_descriptor::free ()
{
if (psd)
{
if (type == local_alloced)
LocalFree (psd);
else
::free (psd);
}
::free (psd);
psd = NULL;
sd_size = 0;
type = local_alloced;
}
#if 0 // unused