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:12 -0500
commitf7c447525eb8c2e34ddd34395be0773565d74cf5 (patch)
tree24234598f50552b17de8fe88dae58b89cd9ae3f0
parentcb929e7df08443b7633920a15e56860c384fc012 (diff)
downloadsssd-f7c447525eb8c2e34ddd34395be0773565d74cf5.tar.gz
sssd-f7c447525eb8c2e34ddd34395be0773565d74cf5.tar.xz
sssd-f7c447525eb8c2e34ddd34395be0773565d74cf5.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 77ffd80c1..bf4c421b6 100644
--- a/src/responder/ssh/sshsrv_cmd.c
+++ b/src/responder/ssh/sshsrv_cmd.c
@@ -481,6 +481,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) {
@@ -494,7 +495,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;