mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-20 12:54:16 +01:00
do_chalendge needs drop privs twice at reading and writing
This commit is contained in:
parent
1036873b95
commit
3d22ed0c15
10
pam_yubico.c
10
pam_yubico.c
@ -588,10 +588,12 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
|
||||
/* point to the fresh privs structure.. */
|
||||
privs = privs2;
|
||||
/* Drop privileges before creating new challenge file. */
|
||||
if (!cfg->chalresp_path) {
|
||||
if (pam_modutil_drop_priv(pamh, &privs, p)) {
|
||||
DBG (("could not drop privileges"));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* Write out the new file */
|
||||
tmpfile = malloc(strlen(userfile) + 1 + 4);
|
||||
@ -624,20 +626,16 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
|
||||
goto restpriv_out;
|
||||
}
|
||||
|
||||
if (pam_modutil_regain_priv(pamh, &privs)) {
|
||||
DBG (("could not restore privileges"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
DBG(("Challenge-response success!"));
|
||||
errstr = NULL;
|
||||
errno = 0;
|
||||
goto out;
|
||||
|
||||
restpriv_out:
|
||||
if (!cfg->chalresp_path) {
|
||||
if (pam_modutil_regain_priv(pamh, &privs)) {
|
||||
DBG (("could not restore privileges"));
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (yk_errno) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user