summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2012-03-07 07:54:49 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-03-09 14:17:08 -0500
commit2f67511518941f8591223851ba23683aa6f3db67 (patch)
tree2316cfbaa7b32f82d476ad6b0bb8e3dcc36421df
parentd9a3ab1bb058ffcd88688d155a1f07cefef8b257 (diff)
downloadsssd-2f67511518941f8591223851ba23683aa6f3db67.tar.gz
sssd-2f67511518941f8591223851ba23683aa6f3db67.tar.xz
sssd-2f67511518941f8591223851ba23683aa6f3db67.zip
Add umask before mkstemp() call in SSH responder
-rw-r--r--src/responder/ssh/sshsrv_cmd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/responder/ssh/sshsrv_cmd.c b/src/responder/ssh/sshsrv_cmd.c
index be79f0c9c..14e24ebc5 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -483,6 +483,7 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx)
int fd = -1;
char *filename, *pubkey, *line;
ssize_t wret;
+ mode_t old_mask;
tmp_ctx = talloc_new(NULL);
if (!tmp_ctx) {
@@ -496,7 +497,9 @@ ssh_host_pubkeys_update_known_hosts(struct ssh_cmd_ctx *cmd_ctx)
goto done;
}
+ old_mask = umask(0133);
fd = mkstemp(filename);
+ umask(old_mask)
if (fd == -1) {
filename = NULL;
ret = errno;