Skip to content

Commit

Permalink
improved debug messages when getpwnam_r() doesn't return a user
Browse files Browse the repository at this point in the history
  • Loading branch information
klali committed Aug 30, 2017
1 parent 3d0d9f5 commit dbaf857
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pam_yubico.c
Expand Up @@ -168,8 +168,12 @@ authorize_user_token (struct cfg *cfg,

pwres = getpwnam_r (username, &pass, buf, buflen, &p);
if (p == NULL) {
DBG ("getpwnam_r: %s", strerror(pwres));
return AUTH_ERROR;
if (pwres == 0) {
DBG ("User '%s' not found", username);
} else {
DBG ("getpwnam_r: %s", strerror(pwres));
}
return AUTH_ERROR;
}

/* Getting file from user home directory
Expand Down Expand Up @@ -475,7 +479,11 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)

pwres = getpwnam_r (username, &pass, pwbuf, pwbuflen, &p);
if (p == NULL) {
DBG ("getpwnam_r: %s", strerror(pwres));
if (pwres == 0) {
DBG ("User '%s' not found", username);
} else {
DBG ("getpwnam_r: %s", strerror(pwres));
}
goto out;
}

Expand Down

0 comments on commit dbaf857

Please sign in to comment.