mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-01-20 10:52:16 +01:00
Use mkotemp() instead of mkstemp()
This uses mkostemp() instead of mkstemp(), passing along the `O_CLOEXEC` flag, which makes sure that the file descriptor is closed and won't be leaked into any child process, which was previously an issue due to a missing fclose() (#136).
This commit is contained in:
parent
d51124e884
commit
0b595ee1cd
@ -654,7 +654,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
|
|||||||
strcpy(tmpfile, userfile);
|
strcpy(tmpfile, userfile);
|
||||||
strcat(tmpfile, TMPFILE_SUFFIX);
|
strcat(tmpfile, TMPFILE_SUFFIX);
|
||||||
|
|
||||||
fd = mkstemp(tmpfile);
|
fd = mkostemp(tmpfile, O_CLOEXEC);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
DBG ("Cannot open file: %s (%s)", tmpfile, strerror(errno));
|
DBG ("Cannot open file: %s (%s)", tmpfile, strerror(errno));
|
||||||
goto restpriv_out;
|
goto restpriv_out;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user