diff options
author | truckman <truckman@FreeBSD.org> | 2016-05-16 08:34:17 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2016-05-16 08:34:17 +0000 |
commit | 4490b45732f3eef1f1ad1afe160f2b7b7a3fa5b3 (patch) | |
tree | 18b2d757593ad5c7b95ade7facce9d52dd3c0bd8 /lib | |
parent | 89eb27d42aa97e0f42dc26e1705f8618e00f45cc (diff) | |
download | FreeBSD-src-4490b45732f3eef1f1ad1afe160f2b7b7a3fa5b3.zip FreeBSD-src-4490b45732f3eef1f1ad1afe160f2b7b7a3fa5b3.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libpam/modules/pam_unix/pam_unix.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libpam/modules/pam_unix/pam_unix.c b/lib/libpam/modules/pam_unix/pam_unix.c index 9a213e2..8c6b822 100644 --- a/lib/libpam/modules/pam_unix/pam_unix.c +++ b/lib/libpam/modules/pam_unix/pam_unix.c @@ -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); |