Store the domain name and user SID in the session too.

svn path=/trunk/; revision=72814
This commit is contained in:
Eric Kohl 2016-09-26 16:28:10 +00:00
parent a5bb3a9997
commit 2f75d2cf5a
3 changed files with 44 additions and 4 deletions

View 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);

View 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);

View 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;
}