mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-20 12:54:16 +01:00
check if user file exists before trying to open
and return AUTH_NO_TOKENS if file doesn't exist. This fixes issues in the nullok case where this user should just be skipped over, handle other issues with user file as an AUTH_ERROR. fixes #194
This commit is contained in:
parent
fcfcba6c2f
commit
f300115a64
@ -181,6 +181,7 @@ authorize_user_token (struct cfg *cfg,
|
|||||||
size_t buflen = sizeof(buf);
|
size_t buflen = sizeof(buf);
|
||||||
int pwres;
|
int pwres;
|
||||||
PAM_MODUTIL_DEF_PRIVS(privs);
|
PAM_MODUTIL_DEF_PRIVS(privs);
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
pwres = getpwnam_r (username, &pass, buf, buflen, &p);
|
pwres = getpwnam_r (username, &pass, buf, buflen, &p);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
@ -206,7 +207,11 @@ authorize_user_token (struct cfg *cfg,
|
|||||||
goto free_out;
|
goto free_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = check_user_token (userfile, username, otp_id, cfg->debug, cfg->debug_file);
|
if (stat (userfile, &st) != 0 && errno == ENOENT) {
|
||||||
|
retval = AUTH_NO_TOKENS;
|
||||||
|
} else {
|
||||||
|
retval = check_user_token (userfile, username, otp_id, cfg->debug, cfg->debug_file);
|
||||||
|
}
|
||||||
|
|
||||||
if(pam_modutil_regain_priv(pamh, &privs)) {
|
if(pam_modutil_regain_priv(pamh, &privs)) {
|
||||||
DBG ("could not restore privileges");
|
DBG ("could not restore privileges");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user