summaryrefslogtreecommitdiff
path: root/modules/pam_localuser/pam_localuser.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-05-01 21:44:59 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-05-21 16:51:52 +0000
commit7d878c8471b56c018c04bfe9b83bea5fecd70f90 (patch)
tree7b1c2043590d9ee3870d2e95f8e06ec57e9f1f91 /modules/pam_localuser/pam_localuser.c
parentc6c3b3f9f7f7024fbbaff3edf0f57c8cb945b4c5 (diff)
pam_localuser: return PAM_INCOMPLETE when pam_get_user returns PAM_CONV_AGAIN
Give the application a chance to handle PAM_INCOMPLETE. * modules/pam_localuser/pam_localuser.c (pam_sm_authenticate): Return PAM_INCOMPLETE instead of PAM_SERVICE_ERR when pam_get_user returns PAM_CONV_AGAIN. * modules/pam_localuser/pam_localuser.8.xml (RETURN VALUES): Document it.
Diffstat (limited to 'modules/pam_localuser/pam_localuser.c')
-rw-r--r--modules/pam_localuser/pam_localuser.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/pam_localuser/pam_localuser.c b/modules/pam_localuser/pam_localuser.c
index 249d09cf..9ffd54a3 100644
--- a/modules/pam_localuser/pam_localuser.c
+++ b/modules/pam_localuser/pam_localuser.c
@@ -60,7 +60,7 @@ int
pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
int argc, const char **argv)
{
- int i, ret = PAM_SUCCESS;
+ int i, ret;
FILE *fp;
int debug = 0;
const char *filename = "/etc/passwd";
@@ -95,9 +95,10 @@ pam_sm_authenticate (pam_handle_t *pamh, int flags UNUSED,
}
}
- if(pam_get_user(pamh, &user, NULL) != PAM_SUCCESS) {
- pam_syslog (pamh, LOG_ERR, "user name not specified yet");
- return PAM_SERVICE_ERR;
+ /* Obtain the user name. */
+ if ((ret = pam_get_user(pamh, &user, NULL)) != PAM_SUCCESS) {
+ pam_syslog (pamh, LOG_ERR, "cannot determine user name");
+ return ret == PAM_CONV_AGAIN ? PAM_INCOMPLETE : PAM_SERVICE_ERR;
}
if ((user_len = strlen(user)) == 0) {