Author: ekohl
Date: Tue Jan 1 22:04:41 2013
New Revision: 58094
URL:
http://svn.reactos.org/svn/reactos?rev=58094&view=rev
Log:
[SAMSRV]
SamrGetAliasMembership:
- Change requrred access right from DOMIN_LOOKUP to DOMAIN_GET_ALIAS_MEMBERSHIP.
- Handle the case properly where a user is not a member of any alias.
- Retrieve an alias members RID correctly.
Modified:
trunk/reactos/dll/win32/samsrv/samrpc.c
Modified: trunk/reactos/dll/win32/samsrv/samrpc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
==============================================================================
--- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Tue Jan 1 22:04:41 2013
@@ -2877,6 +2877,7 @@
ULONG DataLength;
ULONG i, j;
NTSTATUS Status;
+ WCHAR NameBuffer[9];
TRACE("SamrGetAliasMembership(%p %p %p)\n",
DomainHandle, SidArray, Membership);
@@ -2884,7 +2885,7 @@
/* Validate the domain handle */
Status = SampValidateDbObject(DomainHandle,
SamDbDomainObject,
- DOMAIN_LOOKUP,
+ DOMAIN_GET_ALIAS_MEMBERSHIP,
&DomainObject);
if (!NT_SUCCESS(Status))
return Status;
@@ -2902,6 +2903,13 @@
KEY_READ,
&MembersKeyHandle);
TRACE("SampRegOpenKey returned %08lX\n", Status);
+
+ if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
+ {
+ Status = STATUS_SUCCESS;
+ goto done;
+ }
+
if (!NT_SUCCESS(Status))
goto done;
@@ -2926,11 +2934,19 @@
MaxSidCount += ValueCount;
}
-
NtClose(MemberKeyHandle);
}
+ if (Status == STATUS_OBJECT_NAME_NOT_FOUND)
+ Status = STATUS_SUCCESS;
+
LocalFree(MemberSidString);
+ }
+
+ if (MaxSidCount == 0)
+ {
+ Status = STATUS_SUCCESS;
+ goto done;
}
TRACE("Maximum sid count: %lu\n", MaxSidCount);
@@ -2962,14 +2978,18 @@
for (j = 0; j < ValueCount; j++)
{
- DataLength = sizeof(ULONG);
+ DataLength = 9 * sizeof(WCHAR);
Status = SampRegEnumerateValue(MemberKeyHandle,
j,
- NULL,
- NULL,
- NULL,
- (PVOID)&RidArray[j],
- &DataLength);
+ NameBuffer,
+ &DataLength,
+ NULL,
+ NULL,
+ NULL);
+ if (NT_SUCCESS(Status))
+ {
+ RidArray[j] = wcstoul(NameBuffer, NULL, 16);
+ }
}
}
@@ -2978,7 +2998,6 @@
LocalFree(MemberSidString);
}
-
done:
if (NT_SUCCESS(Status))