mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 13:23:04 +00:00
[MSGINA]
Create a connection to the LSA upon initialization and use it to change passwords. Logon will use the connection later. svn path=/trunk/; revision=61888
This commit is contained in:
parent
b32e20f0c1
commit
05dbef656f
3 changed files with 51 additions and 29 deletions
|
@ -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;
|
||||||
|
@ -348,30 +345,9 @@ DoChangePassword(
|
||||||
NewPassword1,
|
NewPassword1,
|
||||||
RequestBuffer->NewPassword.MaximumLength);
|
RequestBuffer->NewPassword.MaximumLength);
|
||||||
|
|
||||||
/* Connect to the LSA server */
|
|
||||||
Status = LsaConnectUntrusted(&LsaHandle);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
ERR("LsaConnectUntrusted failed (Status 0x%08lx)\n", Status);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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 +380,6 @@ done:
|
||||||
if (ResponseBuffer != NULL)
|
if (ResponseBuffer != NULL)
|
||||||
LsaFreeReturnBuffer(ResponseBuffer);
|
LsaFreeReturnBuffer(ResponseBuffer);
|
||||||
|
|
||||||
if (LsaHandle != NULL)
|
|
||||||
NtClose(LsaHandle);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -254,6 +254,46 @@ GetRegistrySettings(PGINA_CONTEXT pgContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
BOOL
|
||||||
|
ConnectToLsa(
|
||||||
|
PGINA_CONTEXT pgContext)
|
||||||
|
{
|
||||||
|
LSA_STRING LogonProcessName;
|
||||||
|
LSA_STRING PackageName;
|
||||||
|
LSA_OPERATIONAL_MODE SecurityMode = 0;
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
@ -283,6 +323,13 @@ WlxInitialize(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ConnectToLsa(pgContext))
|
||||||
|
{
|
||||||
|
WARN("ConnectToLsa() failed\n");
|
||||||
|
LocalFree(pgContext);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return the context to winlogon */
|
/* Return the context to winlogon */
|
||||||
*pWlxContext = (PVOID)pgContext;
|
*pWlxContext = (PVOID)pgContext;
|
||||||
pgContext->hDllInstance = hDllInstance;
|
pgContext->hDllInstance = hDllInstance;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue