From 480ff1f8be7d03b3df7a44af703aa11f414c9efe Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 3 Oct 2013 15:41:02 +0000 Subject: [PATCH] [msv1_0] - Fix pointer fix-up of domain name, user name and password. This failed for null pointers. - Update the dispatch table and create a logon session as part of the user logon. svn path=/trunk/; revision=60513 --- reactos/dll/win32/msv1_0/msv1_0.c | 29 ++++++++++++++++++++++++----- reactos/dll/win32/msv1_0/msv1_0.h | 4 ++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/reactos/dll/win32/msv1_0/msv1_0.c b/reactos/dll/win32/msv1_0/msv1_0.c index 260b3583ca8..b5bf8aee5a1 100644 --- a/reactos/dll/win32/msv1_0/msv1_0.c +++ b/reactos/dll/win32/msv1_0/msv1_0.c @@ -882,6 +882,11 @@ LsaApInitializePackage(IN ULONG AuthenticationPackageId, Confidentiality, AuthenticationPackageName); /* Get the dispatch table entries */ + DispatchTable.CreateLogonSession = LsaDispatchTable->CreateLogonSession; + DispatchTable.DeleteLogonSession = LsaDispatchTable->DeleteLogonSession; + DispatchTable.AddCredential = LsaDispatchTable->AddCredential; + DispatchTable.GetCredentials = LsaDispatchTable->GetCredentials; + DispatchTable.DeleteCredential = LsaDispatchTable->DeleteCredential; DispatchTable.AllocateLsaHeap = LsaDispatchTable->AllocateLsaHeap; DispatchTable.FreeLsaHeap = LsaDispatchTable->FreeLsaHeap; DispatchTable.AllocateClientBuffer = LsaDispatchTable->AllocateClientBuffer; @@ -889,7 +894,6 @@ LsaApInitializePackage(IN ULONG AuthenticationPackageId, DispatchTable.CopyToClientBuffer = LsaDispatchTable->CopyToClientBuffer; DispatchTable.CopyFromClientBuffer = LsaDispatchTable->CopyFromClientBuffer; - /* Return the package name */ NameString = DispatchTable.AllocateLsaHeap(sizeof(LSA_STRING)); if (NameString == NULL) @@ -953,6 +957,7 @@ LsaApLogonUser(IN PLSA_CLIENT_REQUEST ClientRequest, SAMPR_ULONG_ARRAY Use = {0, NULL}; PSAMPR_USER_INFO_BUFFER UserInfo = NULL; UNICODE_STRING LogonServer; + BOOLEAN SessionCreated = FALSE; NTSTATUS Status; TRACE("()\n"); @@ -961,7 +966,6 @@ LsaApLogonUser(IN PLSA_CLIENT_REQUEST ClientRequest, TRACE("AuthenticationInformation: %p\n", AuthenticationInformation); TRACE("AuthenticationInformationLength: %lu\n", AuthenticationInformationLength); - *ProfileBuffer = NULL; *ProfileBufferLength = 0; *SubStatus = STATUS_SUCCESS; @@ -977,9 +981,9 @@ LsaApLogonUser(IN PLSA_CLIENT_REQUEST ClientRequest, /* Fix-up pointers in the authentication info */ PtrOffset = (ULONG_PTR)AuthenticationInformation - (ULONG_PTR)ClientAuthenticationBase; - LogonInfo->LogonDomainName.Buffer = (PWSTR)((ULONG_PTR)LogonInfo->LogonDomainName.Buffer + PtrOffset); - LogonInfo->UserName.Buffer = (PWSTR)((ULONG_PTR)LogonInfo->UserName.Buffer + PtrOffset); - LogonInfo->Password.Buffer = (PWSTR)((ULONG_PTR)LogonInfo->Password.Buffer + PtrOffset); + LogonInfo->LogonDomainName.Buffer = FIXUP_POINTER(LogonInfo->LogonDomainName.Buffer, PtrOffset); + LogonInfo->UserName.Buffer = FIXUP_POINTER(LogonInfo->UserName.Buffer, PtrOffset); + LogonInfo->Password.Buffer = FIXUP_POINTER(LogonInfo->Password.Buffer, PtrOffset); TRACE("Domain: %S\n", LogonInfo->LogonDomainName.Buffer); TRACE("User: %S\n", LogonInfo->UserName.Buffer); @@ -1090,6 +1094,16 @@ LsaApLogonUser(IN PLSA_CLIENT_REQUEST ClientRequest, goto done; } + /* Create the logon session */ + Status = DispatchTable.CreateLogonSession(LogonId); + if (!NT_SUCCESS(Status)) + { + TRACE("CreateLogonSession failed (Status %08lx)\n", Status); + goto done; + } + + SessionCreated = TRUE; + /* Build and fill the interactve profile buffer */ Status = BuildInteractiveProfileBuffer(ClientRequest, UserInfo, @@ -1135,6 +1149,9 @@ done: if (!NT_SUCCESS(Status)) { + if (SessionCreated == TRUE) + DispatchTable.DeleteLogonSession(LogonId); + if (*ProfileBuffer != NULL) { DispatchTable.FreeClientBuffer(ClientRequest, @@ -1169,6 +1186,7 @@ done: /* * @unimplemented */ +#if 0 NTSTATUS NTAPI LsaApLogonUserEx(IN PLSA_CLIENT_REQUEST ClientRequest, @@ -1227,5 +1245,6 @@ LsaApLogonUserEx2(IN PLSA_CLIENT_REQUEST ClientRequest, return STATUS_NOT_IMPLEMENTED; } +#endif /* EOF */ diff --git a/reactos/dll/win32/msv1_0/msv1_0.h b/reactos/dll/win32/msv1_0/msv1_0.h index 46021d36b12..2223d294a24 100644 --- a/reactos/dll/win32/msv1_0/msv1_0.h +++ b/reactos/dll/win32/msv1_0/msv1_0.h @@ -36,6 +36,10 @@ #include + +#define FIXUP_POINTER(Pointer, Offset) ((Pointer != NULL) ? ((PWSTR)((ULONG_PTR)Pointer + Offset)) : NULL) + + typedef struct _RPC_SID { UCHAR Revision; -- 2.17.1