Skip to content

Commit b3a0b41

Browse files
committed
[MSGINA] Zero out and don't return old user login info on aborted logon attempts
- WlxLogoff(): Zero out cached Winlogon buffer pointers and some more user login info. - WlxLoggedOutSAS(): Return the logged-in user token handle *ONLY* if the user is actually logging into the system. If (s)he doesn't log in, but instead cancels the Log-On dialog, or chooses to Shutdown/Reboot the computer from that dialog, do *NOT* return any previous logged-in user token handle. For example, in the case of a previously failed logon attempt due to a wrong or corrupted user profile, shutting down the computer from the Log-On dialog would show the following errors in the debugger: ``` err:(.../winlogon/sas.c:757) ImpersonateLoggedOnUser() failed with error 6 err:(.../winlogon/sas.c:859) Shutdown thread returned failure err:(.../winlogon/sas.c:1182) Failed to start the Shutdown thread, Status 0xc0000001 ```
1 parent 8ce870d commit b3a0b41

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

dll/win32/msgina/msgina.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,9 +1045,12 @@ WlxLoggedOutSAS(
10451045
pgContext->pMprNotifyInfo = pMprNotifyInfo;
10461046
pgContext->pProfile = pProfile;
10471047

1048-
10491048
res = pGinaUI->LoggedOutSAS(pgContext);
1050-
*phToken = pgContext->UserToken;
1049+
1050+
/* Return the logon information only if necessary */
1051+
if (res == WLX_SAS_ACTION_LOGON)
1052+
*phToken = pgContext->UserToken;
1053+
10511054
return res;
10521055
}
10531056

@@ -1114,6 +1117,20 @@ WlxLogoff(
11141117

11151118
TRACE("WlxLogoff(%p)\n", pWlxContext);
11161119

1120+
/* Reset the captured Winlogon pointers */
1121+
pgContext->pAuthenticationId = NULL;
1122+
pgContext->pdwOptions = NULL;
1123+
pgContext->pMprNotifyInfo = NULL;
1124+
pgContext->pProfile = NULL;
1125+
1126+
/*
1127+
* Reset user login information.
1128+
* Keep pgContext->UserName and pgContext->DomainName around
1129+
* if we want to show them as default (last logged user) in
1130+
* the Log-On dialog.
1131+
*/
1132+
ZeroMemory(&pgContext->LogonTime, sizeof(pgContext->LogonTime));
1133+
11171134
/* Delete the password */
11181135
SecureZeroMemory(pgContext->Password, sizeof(pgContext->Password));
11191136

0 commit comments

Comments
 (0)