Author: ekohl
Date: Sat Sep 24 09:38:17 2016
New Revision: 72789
URL:
http://svn.reactos.org/svn/reactos?rev=72789&view=rev
Log:
[LSASRV]
LsapSetLogonSessionData: Set the logon type and the user name of the selected session.
LsapGetLogonSessionData: Fix the session data marshalling code.
Now we can retrieve the logon type and user name of the logon sessions.
Modified:
trunk/reactos/dll/win32/lsasrv/authpackage.c
trunk/reactos/dll/win32/lsasrv/lsasrv.h
trunk/reactos/dll/win32/lsasrv/session.c
Modified: trunk/reactos/dll/win32/lsasrv/authpackage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/authpacka…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/authpackage.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/authpackage.c [iso-8859-1] Sat Sep 24 09:38:17 2016
@@ -1606,7 +1606,9 @@
// TokenHandle = NULL;
- Status = LsapSetLogonSessionData(&RequestMsg->LogonUser.Reply.LogonId);
+ Status = LsapSetLogonSessionData(&RequestMsg->LogonUser.Reply.LogonId,
+ LogonType,
+ AccountName);
if (!NT_SUCCESS(Status))
{
ERR("LsapSetLogonSessionData failed (Status 0x%08lx)\n", Status);
Modified: trunk/reactos/dll/win32/lsasrv/lsasrv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/lsasrv.h?…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/lsasrv.h [iso-8859-1] Sat Sep 24 09:38:17 2016
@@ -447,7 +447,10 @@
_In_ PLSA_STRING PrimaryKeyValue);
NTSTATUS
-LsapSetLogonSessionData(IN PLUID LogonId);
+LsapSetLogonSessionData(
+ _In_ PLUID LogonId,
+ _In_ ULONG LogonType,
+ _In_ PUNICODE_STRING UserName);
NTSTATUS
LsapEnumLogonSessions(IN OUT PLSA_API_MSG RequestMsg);
Modified: trunk/reactos/dll/win32/lsasrv/session.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/lsasrv/session.c…
==============================================================================
--- trunk/reactos/dll/win32/lsasrv/session.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/lsasrv/session.c [iso-8859-1] Sat Sep 24 09:38:17 2016
@@ -64,7 +64,10 @@
NTSTATUS
-LsapSetLogonSessionData(IN PLUID LogonId)
+LsapSetLogonSessionData(
+ _In_ PLUID LogonId,
+ _In_ ULONG LogonType,
+ _In_ PUNICODE_STRING UserName)
{
PLSAP_LOGON_SESSION Session;
@@ -74,6 +77,17 @@
if (Session == NULL)
return STATUS_NO_SUCH_LOGON_SESSION;
+ TRACE("LogonType %lu\n", LogonType);
+ Session->LogonType = LogonType;
+
+ TRACE("UserName %wZ\n", UserName);
+ Session->UserName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
UserName->MaximumLength);
+ if (Session->UserName.Buffer == NULL)
+ return STATUS_INSUFFICIENT_RESOURCES;
+
+ Session->UserName.Length = UserName->Length;
+ Session->UserName.MaximumLength = UserName->MaximumLength;
+ RtlCopyMemory(Session->UserName.Buffer, UserName->Buffer,
UserName->MaximumLength);
return STATUS_SUCCESS;
}
@@ -369,9 +383,9 @@
if (Session->UserName.MaximumLength != 0)
{
RtlCopyMemory(Ptr, Session->UserName.Buffer,
Session->UserName.MaximumLength);
+ LocalSessionData->UserName.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr + Session->UserName.MaximumLength);
-
- LocalSessionData->UserName.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
}
/* Copy the LogonDomain string */
@@ -380,9 +394,9 @@
if (Session->LogonDomain.MaximumLength != 0)
{
RtlCopyMemory(Ptr, Session->LogonDomain.Buffer,
Session->LogonDomain.MaximumLength);
+ LocalSessionData->LogonDomain.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr + Session->LogonDomain.MaximumLength);
-
- LocalSessionData->LogonDomain.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
}
/* Copy the AuthenticationPackage string */
@@ -391,9 +405,9 @@
if (Session->AuthenticationPackage.MaximumLength != 0)
{
RtlCopyMemory(Ptr, Session->AuthenticationPackage.Buffer,
Session->AuthenticationPackage.MaximumLength);
+ LocalSessionData->AuthenticationPackage.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr +
Session->AuthenticationPackage.MaximumLength);
-
- LocalSessionData->AuthenticationPackage.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
}
LocalSessionData->LogonType = Session->LogonType;
@@ -403,9 +417,9 @@
if (Session->Sid != NULL)
{
RtlCopyMemory(Ptr, Session->Sid, SidLength);
+ LocalSessionData->Sid = (PSID)((ULONG_PTR)Ptr - (ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr + SidLength);
-
- LocalSessionData->Sid = (PSID)((ULONG_PTR)Ptr - (ULONG_PTR)LocalSessionData);
}
/* LogonTime */
@@ -417,9 +431,9 @@
if (Session->LogonServer.MaximumLength != 0)
{
RtlCopyMemory(Ptr, Session->LogonServer.Buffer,
Session->LogonServer.MaximumLength);
+ LocalSessionData->LogonServer.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr + Session->LogonServer.MaximumLength);
-
- LocalSessionData->LogonServer.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
}
/* Copy the DnsDomainName string */
@@ -428,9 +442,9 @@
if (Session->DnsDomainName.MaximumLength != 0)
{
RtlCopyMemory(Ptr, Session->DnsDomainName.Buffer,
Session->DnsDomainName.MaximumLength);
+ LocalSessionData->DnsDomainName.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr + Session->DnsDomainName.MaximumLength);
-
- LocalSessionData->DnsDomainName.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
}
/* Copy the Upn string */
@@ -439,9 +453,9 @@
if (Session->Upn.MaximumLength != 0)
{
RtlCopyMemory(Ptr, Session->Upn.Buffer, Session->Upn.MaximumLength);
+ LocalSessionData->Upn.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
+
Ptr = (PUCHAR)((ULONG_PTR)Ptr + Session->Upn.MaximumLength);
-
- LocalSessionData->Upn.Buffer = (PWSTR)((ULONG_PTR)Ptr -
(ULONG_PTR)LocalSessionData);
}