Skip to content

Commit

Permalink
Merge 2c5d4d4 into 0f6ceab
Browse files Browse the repository at this point in the history
  • Loading branch information
kbabioch committed Apr 6, 2018
2 parents 0f6ceab + 2c5d4d4 commit e5faf4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pam_yubico.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ do_challenge_response(pam_handle_t *pamh, struct cfg *cfg, const char *username)
}
}

fd = open(userfile, O_RDONLY, 0);
fd = open(userfile, O_RDONLY | O_CLOEXEC, 0);
if (fd < 0) {
DBG ("Cannot open file: %s (%s)", userfile, strerror(errno));
goto restpriv_out;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -819,7 +819,7 @@ parse_cfg (int flags, int argc, const char **argv, struct cfg *cfg)
{
if(S_ISREG(st.st_mode))
{
file = fopen(filename, "a");
file = fopen(filename, "ae");
if(file)
{
cfg->debug_file = file;
Expand Down
4 changes: 2 additions & 2 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ check_user_token (const char *authfile,
struct stat st;
FILE *opwfile;

fd = open(authfile, O_RDONLY, 0);
fd = open(authfile, O_RDONLY | O_CLOEXEC, 0);
if (fd < 0) {
if(verbose)
D (debug_file, "Cannot open file: %s (%s)", authfile, strerror(errno));
Expand Down Expand Up @@ -188,7 +188,7 @@ int generate_random(void *buf, int len)
FILE *u;
int res;

u = fopen("/dev/urandom", "r");
u = fopen("/dev/urandom", "re");
if (!u) {
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion ykpamcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, char *output_dir, u

umask(077);

f = fopen (fn, "w");
f = fopen (fn, "we");
if (! f) {
fprintf (stderr, "Failed opening '%s' for writing : %s\n", fn, strerror (errno));
goto out;
Expand Down

0 comments on commit e5faf4d

Please sign in to comment.