mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
Fix RtlEqualSid().
svn path=/trunk/; revision=10062
This commit is contained in:
parent
7f900f8f7e
commit
39da3d41f9
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: sid.c,v 1.2 2004/06/20 23:30:47 gdalsnes Exp $
|
/* $Id: sid.c,v 1.3 2004/07/10 13:11:18 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -24,15 +24,13 @@
|
||||||
BOOLEAN STDCALL
|
BOOLEAN STDCALL
|
||||||
RtlValidSid(IN PSID Sid)
|
RtlValidSid(IN PSID Sid)
|
||||||
{
|
{
|
||||||
if ((Sid->Revision & 0xf) != 1)
|
if (((Sid->Revision & 0xf) != 1) ||
|
||||||
|
(Sid->SubAuthorityCount > 15))
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (Sid->SubAuthorityCount > 15)
|
|
||||||
{
|
return TRUE;
|
||||||
return(FALSE);
|
|
||||||
}
|
|
||||||
return(TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,7 +57,8 @@ RtlInitializeSid(IN PSID Sid,
|
||||||
memcpy(&Sid->IdentifierAuthority,
|
memcpy(&Sid->IdentifierAuthority,
|
||||||
IdentifierAuthority,
|
IdentifierAuthority,
|
||||||
sizeof(SID_IDENTIFIER_AUTHORITY));
|
sizeof(SID_IDENTIFIER_AUTHORITY));
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +69,7 @@ PULONG STDCALL
|
||||||
RtlSubAuthoritySid(IN PSID Sid,
|
RtlSubAuthoritySid(IN PSID Sid,
|
||||||
IN ULONG SubAuthority)
|
IN ULONG SubAuthority)
|
||||||
{
|
{
|
||||||
return(&Sid->SubAuthority[SubAuthority]);
|
return &Sid->SubAuthority[SubAuthority];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,7 +79,7 @@ RtlSubAuthoritySid(IN PSID Sid,
|
||||||
PUCHAR STDCALL
|
PUCHAR STDCALL
|
||||||
RtlSubAuthorityCountSid(IN PSID Sid)
|
RtlSubAuthorityCountSid(IN PSID Sid)
|
||||||
{
|
{
|
||||||
return(&Sid->SubAuthorityCount);
|
return &Sid->SubAuthorityCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,7 +98,7 @@ RtlEqualSid(IN PSID Sid1,
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
if (RtlCompareMemory(Sid1, Sid2, RtlLengthSid(Sid1)) != 0)
|
if (RtlCompareMemory(Sid1, Sid2, RtlLengthSid(Sid1)) != RtlLengthSid(Sid1))
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +112,7 @@ RtlEqualSid(IN PSID Sid1,
|
||||||
ULONG STDCALL
|
ULONG STDCALL
|
||||||
RtlLengthSid(IN PSID Sid)
|
RtlLengthSid(IN PSID Sid)
|
||||||
{
|
{
|
||||||
return(sizeof(SID) + (Sid->SubAuthorityCount-1)*4);
|
return (sizeof(SID) + (Sid->SubAuthorityCount-1) * sizeof(ULONG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,12 +126,14 @@ RtlCopySid(ULONG BufferLength,
|
||||||
{
|
{
|
||||||
if (BufferLength < RtlLengthSid(Src))
|
if (BufferLength < RtlLengthSid(Src))
|
||||||
{
|
{
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(Dest,
|
memmove(Dest,
|
||||||
Src,
|
Src,
|
||||||
RtlLengthSid(Src));
|
RtlLengthSid(Src));
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,17 +182,15 @@ RtlCopySidAndAttributesArray(ULONG Count,
|
||||||
PSID_IDENTIFIER_AUTHORITY STDCALL
|
PSID_IDENTIFIER_AUTHORITY STDCALL
|
||||||
RtlIdentifierAuthoritySid(IN PSID Sid)
|
RtlIdentifierAuthoritySid(IN PSID Sid)
|
||||||
{
|
{
|
||||||
return(&Sid->IdentifierAuthority);
|
return &Sid->IdentifierAuthority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
||||||
RtlAllocateAndInitializeSid (
|
|
||||||
PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
|
||||||
UCHAR SubAuthorityCount,
|
UCHAR SubAuthorityCount,
|
||||||
ULONG SubAuthority0,
|
ULONG SubAuthority0,
|
||||||
ULONG SubAuthority1,
|
ULONG SubAuthority1,
|
||||||
|
@ -201,8 +200,7 @@ RtlAllocateAndInitializeSid (
|
||||||
ULONG SubAuthority5,
|
ULONG SubAuthority5,
|
||||||
ULONG SubAuthority6,
|
ULONG SubAuthority6,
|
||||||
ULONG SubAuthority7,
|
ULONG SubAuthority7,
|
||||||
PSID *Sid
|
PSID *Sid)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PSID pSid;
|
PSID pSid;
|
||||||
|
|
||||||
|
@ -212,7 +210,8 @@ RtlAllocateAndInitializeSid (
|
||||||
if (Sid == NULL)
|
if (Sid == NULL)
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
pSid = (PSID)ExAllocatePool(PagedPool, SubAuthorityCount * sizeof(DWORD) + 8);
|
pSid = (PSID)ExAllocatePool(PagedPool,
|
||||||
|
sizeof(SID) + (SubAuthorityCount - 1) * sizeof(ULONG));
|
||||||
if (pSid == NULL)
|
if (pSid == NULL)
|
||||||
return STATUS_NO_MEMORY;
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue