1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Fix `puttygen-unix-perms': f_open(), PuTTY's wrapper on fopen, now

takes a third argument which is TRUE if the file is being opened for
writing and wants to be created in such a way that it's readable
only to the owner. This is used when saving private keys.

While I'm here, I also use this option when writing session logs, on
the general principle that they probably contain _something_
sensitive.

The new argument is only supported on Unix, for the moment. (I think
writing owner-accessible-only files is the default on Windows.)

[originally from svn r7084]
This commit is contained in:
Simon Tatham
2007-01-09 18:14:30 +00:00
parent dbbd6eb5ec
commit 4fa9564c90
9 changed files with 37 additions and 22 deletions

View File

@ -893,7 +893,7 @@ int main(int argc, char **argv)
assert(ssh1key);
if (outfile)
fp = f_open(outfilename, "w");
fp = f_open(outfilename, "w", FALSE);
else
fp = stdout;
dec1 = bignum_decimal(ssh1key->exponent);
@ -951,7 +951,7 @@ int main(int argc, char **argv)
*p++ = '\0';
if (outfile)
fp = f_open(outfilename, "w");
fp = f_open(outfilename, "w", FALSE);
else
fp = stdout;
fprintf(fp, "%s\n", buffer);
@ -981,7 +981,7 @@ int main(int argc, char **argv)
}
if (outfile)
fp = f_open(outfilename, "w");
fp = f_open(outfilename, "w", FALSE);
else
fp = stdout;
fprintf(fp, "%s\n", fingerprint);