Save the password in the gina-context after successful logon and use it to check the password when unlocking the computer.

svn path=/trunk/; revision=61741
This commit is contained in:
Eric Kohl 2014-01-20 21:23:17 +00:00
parent d74e783572
commit c3cdc1abae
3 changed files with 22 additions and 7 deletions

View file

@ -527,6 +527,12 @@ LoggedOutWindowProc(
if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) && if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) &&
DoLoginTasks(pgContext, UserName, NULL, Password)) DoLoginTasks(pgContext, UserName, NULL, Password))
{ {
pgContext->Password = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
(wcslen(Password) + 1) * sizeof(WCHAR));
if (pgContext->Password != NULL)
wcscpy(pgContext->Password, Password);
result = WLX_SAS_ACTION_LOGON; result = WLX_SAS_ACTION_LOGON;
} }
HeapFree(GetProcessHeap(), 0, UserName); HeapFree(GetProcessHeap(), 0, UserName);
@ -648,22 +654,23 @@ UnlockWindowProc(
{ {
case IDOK: case IDOK:
{ {
#if 0
LPWSTR UserName = NULL, Password = NULL; LPWSTR UserName = NULL, Password = NULL;
INT result = WLX_SAS_ACTION_NONE; INT result = WLX_SAS_ACTION_NONE;
if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0') if (GetTextboxText(hwndDlg, IDC_USERNAME, &UserName) && *UserName == '\0')
break; break;
if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password) && if (GetTextboxText(hwndDlg, IDC_PASSWORD, &Password))
DoLoginTasks(pgContext, UserName, NULL, Password))
{ {
result = WLX_SAS_ACTION_LOGON; if (UserName != NULL && Password != NULL &&
wcscmp(UserName, pgContext->UserName) == 0 &&
wcscmp(Password, pgContext->Password) == 0)
{
result = WLX_SAS_ACTION_UNLOCK_WKSTA;
}
} }
HeapFree(GetProcessHeap(), 0, UserName); HeapFree(GetProcessHeap(), 0, UserName);
HeapFree(GetProcessHeap(), 0, Password); HeapFree(GetProcessHeap(), 0, Password);
EndDialog(hwndDlg, result); EndDialog(hwndDlg, result);
#endif
EndDialog(hwndDlg, WLX_SAS_ACTION_UNLOCK_WKSTA);
return TRUE; return TRUE;
} }

View file

@ -817,8 +817,16 @@ DoAutoLogon(
result = DoLoginTasks(pgContext, UserName, DomainName, Password); result = DoLoginTasks(pgContext, UserName, DomainName, Password);
if (result == TRUE) if (result == TRUE)
{
pgContext->Password = HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
(wcslen(Password) + 1) * sizeof(WCHAR));
if (pgContext->Password != NULL)
wcscpy(pgContext->Password, Password);
NotifyBootConfigStatus(TRUE); NotifyBootConfigStatus(TRUE);
} }
}
cleanup: cleanup:
if (WinLogonKey != NULL) if (WinLogonKey != NULL)
@ -852,7 +860,6 @@ WlxDisplaySASNotice(
return; return;
} }
// if (CheckAutoAdminLogon(pgContext))
if (pgContext->bAutoAdminLogon == TRUE) if (pgContext->bAutoAdminLogon == TRUE)
{ {
/* Don't display the window, we want to do an automatic logon */ /* Don't display the window, we want to do an automatic logon */

View file

@ -42,6 +42,7 @@ typedef struct
/* Information to be filled during logon */ /* Information to be filled during logon */
WCHAR UserName[256]; WCHAR UserName[256];
WCHAR Domain[256]; WCHAR Domain[256];
LPWSTR Password;
SYSTEMTIME LogonTime; SYSTEMTIME LogonTime;
HANDLE UserToken; HANDLE UserToken;
PLUID pAuthenticationId; PLUID pAuthenticationId;