mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Hoist the getpwnam() call outside the first if/else block in
pam_sm_chauthtok(). Set user = getlogin() inside the true branch so that it is initialized for the following PAM_LOG() call. This is how it is done in pam_sm_authenticate(). Reported by: Coverity CID: 272498 MFC after: 1 week
This commit is contained in:
parent
bba8dcbcd3
commit
653d2f366d
1 changed files with 2 additions and 2 deletions
|
|
@ -278,13 +278,13 @@ pam_sm_chauthtok(pam_handle_t *pamh, int flags,
|
|||
int pfd, tfd, retval;
|
||||
|
||||
if (openpam_get_option(pamh, PAM_OPT_AUTH_AS_SELF))
|
||||
pwd = getpwnam(getlogin());
|
||||
user = getlogin();
|
||||
else {
|
||||
retval = pam_get_user(pamh, &user, NULL);
|
||||
if (retval != PAM_SUCCESS)
|
||||
return (retval);
|
||||
pwd = getpwnam(user);
|
||||
}
|
||||
pwd = getpwnam(user);
|
||||
|
||||
if (pwd == NULL)
|
||||
return (PAM_AUTHTOK_RECOVERY_ERR);
|
||||
|
|
|
|||
Loading…
Reference in a new issue