Address Group Matching Issue (#380)

- Addressed group mapping issue caused by the username being used after being freed.
PowerShell/Win32-OpenSSH#1354
This commit is contained in:
Bryan Berns 2019-03-25 12:59:38 -04:00 committed by Manoj Ampalam
parent 2abb7748a9
commit afe4880c37
1 changed files with 5 additions and 2 deletions

7
auth.c
View File

@ -595,9 +595,12 @@ getpwnamallow(const char *user)
struct passwd *pw;
struct connection_info *ci = get_connection_info(1, options.use_dns);
#ifdef WINDOWS
/* getpwname - normalizes the incoming user and makes it lowercase */
/* getpwname - normalizes the incoming user and makes it lowercase
/* it must be duped as the server matching routines may use getpwnam() and
* and free the name being assigned to the connection info structure
*/
pw = getpwnam(user);
ci->user = pw? pw->pw_name: user;
ci->user = pw? xstrdup(pw->pw_name): user;
#else
ci->user = user;
#endif // WINDOWS