1
0
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:
Karol Babioch 2018-04-05 14:28:03 +02:00
parent d51124e884
commit 0b595ee1cd

View File

@ -654,7 +654,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
strcpy(tmpfile, userfile);
strcat(tmpfile, TMPFILE_SUFFIX);
fd = mkstemp(tmpfile);
fd = mkostemp(tmpfile, O_CLOEXEC);
if (fd < 0) {
DBG ("Cannot open file: %s (%s)", tmpfile, strerror(errno));
goto restpriv_out;