mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-21 15:54:41 +01:00
Drop privileges before writing new C-R file.
This commit is contained in:
parent
94885d2d48
commit
f24f333867
11
pam_yubico.c
11
pam_yubico.c
@ -573,6 +573,12 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
|
||||
memcpy (state.response, buf, response_len);
|
||||
state.response_len = response_len;
|
||||
|
||||
/* Drop privileges before creating new challenge file. */
|
||||
if (drop_privileges(p, pamh) < 0) {
|
||||
D (("could not drop privileges"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Write out the new file */
|
||||
tmpfile = malloc(strlen(userfile) + 1 + 4);
|
||||
if (! tmpfile)
|
||||
@ -596,6 +602,11 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (restore_privileges(pamh) < 0) {
|
||||
DBG (("could not restore privileges"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
DBG(("Challenge-response success!"));
|
||||
errstr = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user