Author: ekohl
Date: Sat Dec 28 23:47:04 2013
New Revision: 61460
URL:
http://svn.reactos.org/svn/reactos?rev=61460&view=rev
Log:
[MSV1_0]
- Code clean-up.
- Take the user RID and pimary group RID from the user info data.
Modified:
trunk/reactos/dll/win32/msv1_0/msv1_0.c
Modified: trunk/reactos/dll/win32/msv1_0/msv1_0.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msv1_0/msv1_0.c?…
==============================================================================
--- trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msv1_0/msv1_0.c [iso-8859-1] Sat Dec 28 23:47:04 2013
@@ -257,7 +257,7 @@
if (User->User.Sid == NULL)
{
ERR("Could not create the user SID\n");
- return STATUS_UNSUCCESSFUL;
+ return STATUS_INSUFFICIENT_RESOURCES;
}
User->User.Attributes = 0;
@@ -268,10 +268,26 @@
static
NTSTATUS
-BuildTokenGroups(IN PSID AccountDomainSid,
- IN PLUID LogonId,
- OUT PTOKEN_GROUPS *Groups,
- OUT PSID *PrimaryGroupSid)
+BuildTokenPrimaryGroup(OUT PTOKEN_PRIMARY_GROUP PrimaryGroup,
+ IN PSID AccountDomainSid,
+ IN ULONG RelativeId)
+{
+ PrimaryGroup->PrimaryGroup = AppendRidToSid(AccountDomainSid,
+ RelativeId);
+ if (PrimaryGroup->PrimaryGroup == NULL)
+ {
+ ERR("Could not create the primary group SID\n");
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ return STATUS_SUCCESS;
+}
+
+
+static
+NTSTATUS
+BuildTokenGroups(OUT PTOKEN_GROUPS *Groups,
+ IN PSID AccountDomainSid)
{
SID_IDENTIFIER_AUTHORITY SystemAuthority = {SECURITY_NT_AUTHORITY};
PTOKEN_GROUPS TokenGroups;
@@ -297,7 +313,6 @@
TokenGroups->Groups[GroupCount].Sid = Sid;
TokenGroups->Groups[GroupCount].Attributes =
SE_GROUP_ENABLED | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_MANDATORY;
- *PrimaryGroupSid = Sid;
GroupCount++;
@@ -365,30 +380,6 @@
return Status;
}
-
-static
-NTSTATUS
-BuildTokenPrimaryGroup(PTOKEN_PRIMARY_GROUP PrimaryGroup,
- PSID PrimaryGroupSid)
-{
- ULONG RidCount;
- ULONG Size;
-
- RidCount = *RtlSubAuthorityCountSid(PrimaryGroupSid);
- Size = RtlLengthRequiredSid(RidCount);
-
- PrimaryGroup->PrimaryGroup = DispatchTable.AllocateLsaHeap(Size);
- if (PrimaryGroup->PrimaryGroup == NULL)
- {
- return STATUS_INSUFFICIENT_RESOURCES;
- }
-
- RtlCopyMemory(PrimaryGroup->PrimaryGroup,
- PrimaryGroupSid,
- Size);
-
- return STATUS_SUCCESS;
-}
static
NTSTATUS
@@ -480,11 +471,9 @@
NTSTATUS
BuildTokenInformationBuffer(PLSA_TOKEN_INFORMATION_V1 *TokenInformation,
PRPC_SID AccountDomainSid,
- ULONG RelativeId,
- PLUID LogonId)
+ PSAMPR_USER_INFO_BUFFER UserInfo)
{
PLSA_TOKEN_INFORMATION_V1 Buffer = NULL;
- PSID PrimaryGroupSid = NULL;
ULONG i;
NTSTATUS Status = STATUS_SUCCESS;
@@ -501,19 +490,18 @@
Status = BuildTokenUser(&Buffer->User,
(PSID)AccountDomainSid,
- RelativeId);
- if (!NT_SUCCESS(Status))
- goto done;
-
- Status = BuildTokenGroups((PSID)AccountDomainSid,
- LogonId,
- &Buffer->Groups,
- &PrimaryGroupSid);
+ UserInfo->All.UserId);
if (!NT_SUCCESS(Status))
goto done;
Status = BuildTokenPrimaryGroup(&Buffer->PrimaryGroup,
- PrimaryGroupSid);
+ (PSID)AccountDomainSid,
+ UserInfo->All.PrimaryGroupId);
+ if (!NT_SUCCESS(Status))
+ goto done;
+
+ Status = BuildTokenGroups(&Buffer->Groups,
+ (PSID)AccountDomainSid);
if (!NT_SUCCESS(Status))
goto done;
@@ -1047,8 +1035,7 @@
/* Build and fill the token information buffer */
Status = BuildTokenInformationBuffer((PLSA_TOKEN_INFORMATION_V1*)TokenInformation,
AccountDomainSid,
- RelativeIds.Element[0],
- LogonId);
+ UserInfo);
if (!NT_SUCCESS(Status))
{
TRACE("BuildTokenInformationBuffer failed (Status %08lx)\n", Status);