1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-15 18:17:32 -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

@ -85,7 +85,7 @@ static void logfopen_callback(void *handle, int mode)
ctx->state = L_ERROR; /* disable logging */
} else {
fmode = (mode == 1 ? "ab" : "wb");
ctx->lgfp = f_open(ctx->currlogfilename, fmode);
ctx->lgfp = f_open(ctx->currlogfilename, fmode, TRUE);
if (ctx->lgfp)
ctx->state = L_OPEN;
else
@ -149,7 +149,7 @@ void logfopen(void *handle)
/* substitute special codes in file name */
xlatlognam(&ctx->currlogfilename, ctx->cfg.logfilename,ctx->cfg.host, &tm);
ctx->lgfp = f_open(ctx->currlogfilename, "r"); /* file already present? */
ctx->lgfp = f_open(ctx->currlogfilename, "r", FALSE); /* file already present? */
if (ctx->lgfp) {
fclose(ctx->lgfp);
if (ctx->cfg.logxfovr != LGXF_ASK) {