Skip to content

Commit

Permalink
copy ownership and modes of old challenge file when creating a new one
Browse files Browse the repository at this point in the history
fixes #92
  • Loading branch information
klali committed Mar 30, 2016
1 parent b7e7da4 commit 155b485
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pam_yubico.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,14 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
goto restpriv_out;
}

if (fchmod (fd, S_IRUSR | S_IWUSR) != 0) {
if (fchmod (fd, st.st_mode) != 0) {
DBG (("could not set correct file permissions"));
goto restpriv_out;
}
if (fchown (fd, st.st_uid, st.st_gid) != 0) {
DBG (("could not set correct file ownership"));
goto restpriv_out;
}

f = fdopen(fd, "w");
if (! f) {
Expand Down

0 comments on commit 155b485

Please sign in to comment.