mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-20 21:54:16 +01:00
use umask instead of chmod to set file permissions
This commit is contained in:
parent
e6b63cf05b
commit
9eb630a383
@ -236,6 +236,8 @@ do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, char *output_dir, u
|
||||
memcpy (state.response, buf, response_len);
|
||||
state.response_len = response_len;
|
||||
|
||||
umask(077);
|
||||
|
||||
f = fopen (fn, "w");
|
||||
if (! f) {
|
||||
fprintf (stderr, "Failed opening '%s' for writing : %s\n", fn, strerror (errno));
|
||||
@ -245,11 +247,6 @@ do_add_hmac_chalresp(YK_KEY *yk, uint8_t slot, bool verbose, char *output_dir, u
|
||||
if (! write_chalresp_state (f, &state))
|
||||
goto out;
|
||||
|
||||
if (! chmod (fn, S_IRUSR | S_IWUSR)) {
|
||||
fprintf (stderr, "Failed setting permissions on new challenge file %s.\n", fn);
|
||||
goto out;
|
||||
}
|
||||
|
||||
printf ("Stored initial challenge and expected response in '%s'.\n", fn);
|
||||
|
||||
*exit_code = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user