Move the LSA connection code into a separate file. This connection code will later be used by the logon code too.

svn path=/trunk/; revision=61919
This commit is contained in:
Eric Kohl 2014-02-02 12:12:59 +00:00
parent cfe9329efe
commit e63eb57839
4 changed files with 66 additions and 25 deletions

View file

@ -7,6 +7,7 @@ spec2def(msgina.dll msgina.spec)
list(APPEND SOURCE list(APPEND SOURCE
gui.c gui.c
lsa.c
msgina.c msgina.c
stubs.c stubs.c
tui.c tui.c

View file

@ -259,9 +259,6 @@ DoChangePassword(
ULONG RequestBufferSize; ULONG RequestBufferSize;
ULONG ResponseBufferSize = 0; ULONG ResponseBufferSize = 0;
LPWSTR Ptr; LPWSTR Ptr;
LSA_STRING PackageName;
HANDLE LsaHandle = NULL;
ULONG AuthenticationPackage = 0;
BOOL res = FALSE; BOOL res = FALSE;
NTSTATUS ProtocolStatus; NTSTATUS ProtocolStatus;
NTSTATUS Status; NTSTATUS Status;
@ -349,29 +346,15 @@ DoChangePassword(
RequestBuffer->NewPassword.MaximumLength); RequestBuffer->NewPassword.MaximumLength);
/* Connect to the LSA server */ /* Connect to the LSA server */
Status = LsaConnectUntrusted(&LsaHandle); if (!ConnectToLsa(pgContext))
if (!NT_SUCCESS(Status))
{ {
ERR("LsaConnectUntrusted failed (Status 0x%08lx)\n", Status); ERR("ConnectToLsa() failed\n");
goto done; return FALSE;
}
/* Get the authentication package */
RtlInitAnsiString((PANSI_STRING)&PackageName,
MSV1_0_PACKAGE_NAME);
Status = LsaLookupAuthenticationPackage(LsaHandle,
&PackageName,
&AuthenticationPackage);
if (!NT_SUCCESS(Status))
{
ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n", Status);
goto done;
} }
/* Call the authentication package */ /* Call the authentication package */
Status = LsaCallAuthenticationPackage(LsaHandle, Status = LsaCallAuthenticationPackage(pgContext->LsaHandle,
AuthenticationPackage, pgContext->AuthenticationPackage,
RequestBuffer, RequestBuffer,
RequestBufferSize, RequestBufferSize,
(PVOID*)&ResponseBuffer, (PVOID*)&ResponseBuffer,
@ -404,9 +387,6 @@ done:
if (ResponseBuffer != NULL) if (ResponseBuffer != NULL)
LsaFreeReturnBuffer(ResponseBuffer); LsaFreeReturnBuffer(ResponseBuffer);
if (LsaHandle != NULL)
NtClose(LsaHandle);
return res; return res;
} }

View file

@ -0,0 +1,52 @@
/*
* PROJECT: ReactOS msgina.dll
* FILE: dll/win32/msgina/gui.c
* PURPOSE: ReactOS Logon GINA DLL
* PROGRAMMER: Eric Kohl
*/
#include "msgina.h"
BOOL
ConnectToLsa(
PGINA_CONTEXT pgContext)
{
LSA_STRING LogonProcessName;
LSA_STRING PackageName;
LSA_OPERATIONAL_MODE SecurityMode = 0;
NTSTATUS Status;
/* We are already connected to the LSA */
if (pgContext->LsaHandle != NULL)
return TRUE;
/* Connect to the LSA server */
RtlInitAnsiString((PANSI_STRING)&LogonProcessName,
"MSGINA");
Status = LsaRegisterLogonProcess(&LogonProcessName,
&pgContext->LsaHandle,
&SecurityMode);
if (!NT_SUCCESS(Status))
{
ERR("LsaRegisterLogonProcess failed (Status 0x%08lx)\n", Status);
return FALSE;
}
/* Get the authentication package */
RtlInitAnsiString((PANSI_STRING)&PackageName,
MSV1_0_PACKAGE_NAME);
Status = LsaLookupAuthenticationPackage(pgContext->LsaHandle,
&PackageName,
&pgContext->AuthenticationPackage);
if (!NT_SUCCESS(Status))
{
ERR("LsaLookupAuthenticationPackage failed (Status 0x%08lx)\n", Status);
return FALSE;
}
return TRUE;
}
/* EOF */

View file

@ -38,6 +38,8 @@ typedef struct
PWLX_DISPATCH_VERSION_1_3 pWlxFuncs; PWLX_DISPATCH_VERSION_1_3 pWlxFuncs;
HANDLE hDllInstance; HANDLE hDllInstance;
HWND hStatusWindow; HWND hStatusWindow;
HANDLE LsaHandle;
ULONG AuthenticationPackage;
DWORD AutoLogonState; DWORD AutoLogonState;
BOOL bDisableCAD; BOOL bDisableCAD;
BOOL bAutoAdminLogon; BOOL bAutoAdminLogon;
@ -82,6 +84,12 @@ typedef struct _GINA_UI
PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice; PFGINA_DISPLAYLOCKEDNOTICE DisplayLockedNotice;
} GINA_UI, *PGINA_UI; } GINA_UI, *PGINA_UI;
/* lsa.c */
BOOL
ConnectToLsa(
PGINA_CONTEXT pgContext);
/* msgina.c */ /* msgina.c */
BOOL BOOL