summaryrefslogtreecommitdiff
path: root/modules/pam_tally
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-05-16 08:00:00 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-05-16 08:00:00 +0000
commitb52bd25910c9a8a32a49be7627a709a081a3768c (patch)
treec32db20bd3200b8f134d9f64883ea74c853627b7 /modules/pam_tally
parentf80ff0161f77abc84ebeee6147931f0924b9a867 (diff)
modules: do not check user name for emptyness before passing it to pam_modutil_getpwnam
pam_modutil_getpwnam is perfectly capable of handling empty strings as user names, no need to double check that. * modules/pam_access/pam_access.c (pam_sm_authenticate): Do not check the user name for emptyness before passing it to pam_modutil_getpwnam. * modules/pam_lastlog/pam_lastlog.c (pam_sm_authenticate): Likewise. * modules/pam_pwhistory/pam_pwhistory.c (pam_sm_chauthtok): Likewise. * modules/pam_shells/pam_shells.c (perform_check): Likewise. * modules/pam_tally/pam_tally.c (pam_get_uid): Likewise. * modules/pam_tally2/pam_tally2.c (pam_get_uid): Likewise. * modules/pam_umask/pam_umask.c (pam_sm_open_session): Likewise.
Diffstat (limited to 'modules/pam_tally')
-rw-r--r--modules/pam_tally/pam_tally.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules/pam_tally/pam_tally.c b/modules/pam_tally/pam_tally.c
index 08b5ace2..f0a28bba 100644
--- a/modules/pam_tally/pam_tally.c
+++ b/modules/pam_tally/pam_tally.c
@@ -227,6 +227,11 @@ pam_get_uid(pam_handle_t *pamh, uid_t *uid, const char **userp, struct tally_opt
#ifdef MAIN
user = cline_user;
+
+ if ( !user ) {
+ pam_syslog(pamh, LOG_ERR, "pam_get_uid; user?");
+ return PAM_AUTH_ERR;
+ }
#else
if ((pam_get_user( pamh, &user, NULL )) != PAM_SUCCESS) {
pam_syslog(pamh, LOG_ERR, "pam_get_user; user?");
@@ -234,11 +239,6 @@ pam_get_uid(pam_handle_t *pamh, uid_t *uid, const char **userp, struct tally_opt
}
#endif
- if ( !user || !*user ) {
- pam_syslog(pamh, LOG_ERR, "pam_get_uid; user?");
- return PAM_AUTH_ERR;
- }
-
if ( ! ( pw = pam_modutil_getpwnam( pamh, user ) ) ) {
opts->ctrl & OPT_AUDIT ?
pam_syslog(pamh, LOG_ERR, "pam_get_uid; no such user %s", user) :