1
0
mirror of https://github.com/Yubico/yubico-pam.git synced 2024-11-29 00:24:11 +01:00

copy ownership and modes of old challenge file when creating a new one

fixes #92
This commit is contained in:
Klas Lindfors 2016-03-30 08:59:06 +02:00
parent b7e7da494a
commit 155b485ba7

View File

@ -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) {