[LSASRV]
authorEric Kohl <eric.kohl@reactos.org>
Mon, 26 Sep 2016 16:28:10 +0000 (16:28 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Mon, 26 Sep 2016 16:28:10 +0000 (16:28 +0000)
Store the domain name and user SID in the session too.

svn path=/trunk/; revision=72814

reactos/dll/win32/lsasrv/authpackage.c
reactos/dll/win32/lsasrv/lsasrv.h
reactos/dll/win32/lsasrv/session.c

index 071b416..8b74f71 100644 (file)
@@ -1380,7 +1380,12 @@ LsapLogonUser(PLSA_API_MSG RequestMsg,
     SECURITY_LOGON_TYPE LogonType;
     NTSTATUS Status;
 
-    TRACE("(%p %p)\n", RequestMsg, LogonContext);
+    PUNICODE_STRING UserName = NULL;
+    PUNICODE_STRING LogonDomainName = NULL;
+//    UNICODE_STRING LogonServer;
+
+
+    TRACE("LsapLogonUser(%p %p)\n", RequestMsg, LogonContext);
 
     PackageId = RequestMsg->LogonUser.Request.AuthenticationPackage;
     LogonType = RequestMsg->LogonUser.Request.LogonType;
@@ -1606,9 +1611,23 @@ LsapLogonUser(PLSA_API_MSG RequestMsg,
 
 //    TokenHandle = NULL;
 
+    if (LogonType == Interactive ||
+        LogonType == Batch ||
+        LogonType == Service)
+    {
+        UserName = &((PMSV1_0_INTERACTIVE_LOGON)LocalAuthInfo)->UserName;
+        LogonDomainName = &((PMSV1_0_INTERACTIVE_LOGON)LocalAuthInfo)->LogonDomainName;
+    }
+    else
+    {
+        FIXME("LogonType %lu is not supported yet!\n", LogonType);
+    }
+
     Status = LsapSetLogonSessionData(&RequestMsg->LogonUser.Reply.LogonId,
                                      LogonType,
-                                     AccountName);
+                                     UserName,
+                                     LogonDomainName,
+                                     TokenInfo1->User.User.Sid);
     if (!NT_SUCCESS(Status))
     {
         ERR("LsapSetLogonSessionData failed (Status 0x%08lx)\n", Status);
index 584d113..06bd2f1 100644 (file)
@@ -450,7 +450,9 @@ NTSTATUS
 LsapSetLogonSessionData(
     _In_ PLUID LogonId,
     _In_ ULONG LogonType,
-    _In_ PUNICODE_STRING UserName);
+    _In_ PUNICODE_STRING UserName,
+    _In_ PUNICODE_STRING LogonDomain,
+    _In_ PSID Sid);
 
 NTSTATUS
 LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg);
index def8fe7..a290e34 100644 (file)
@@ -67,9 +67,12 @@ NTSTATUS
 LsapSetLogonSessionData(
     _In_ PLUID LogonId,
     _In_ ULONG LogonType,
-    _In_ PUNICODE_STRING UserName)
+    _In_ PUNICODE_STRING UserName,
+    _In_ PUNICODE_STRING LogonDomain,
+    _In_ PSID Sid)
 {
     PLSAP_LOGON_SESSION Session;
+    ULONG Length;
 
     TRACE("LsapSetLogonSessionData(%p)\n", LogonId);
 
@@ -89,6 +92,22 @@ LsapSetLogonSessionData(
     Session->UserName.MaximumLength = UserName->MaximumLength;
     RtlCopyMemory(Session->UserName.Buffer, UserName->Buffer, UserName->MaximumLength);
 
+    TRACE("LogonDomain %wZ\n", LogonDomain);
+    Session->LogonDomain.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, LogonDomain->MaximumLength);
+    if (Session->LogonDomain.Buffer == NULL)
+        return STATUS_INSUFFICIENT_RESOURCES;
+
+    Session->LogonDomain.Length = LogonDomain->Length;
+    Session->LogonDomain.MaximumLength = LogonDomain->MaximumLength;
+    RtlCopyMemory(Session->LogonDomain.Buffer, LogonDomain->Buffer, LogonDomain->MaximumLength);
+
+    Length = RtlLengthSid(Sid);
+    Session->Sid = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, Length);
+    if (Session->UserName.Buffer == NULL)
+        return STATUS_INSUFFICIENT_RESOURCES;
+
+    RtlCopyMemory(Session->Sid, Sid, Length);
+
     return STATUS_SUCCESS;
 }