From 90cbfc96d118d6b55c47392d8ae421434dea8225 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 25 Feb 2013 17:34:21 +0100 Subject: Make sure to set umask() before calling mkstemp(). Reviewed-by: David Disseldorp Autobuild-User(master): David Disseldorp Autobuild-Date(master): Wed Mar 6 01:16:34 CET 2013 on sn-devel-104 --- source3/lib/smbrun.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 0ecdc0d683..15a0c886e4 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "system/filesys.h" /* need to move this from here!! need some sleep ... */ struct current_user current_user; @@ -31,6 +32,7 @@ static int setup_out_fd(void) int fd; TALLOC_CTX *ctx = talloc_stackframe(); char *path = NULL; + mode_t mask; path = talloc_asprintf(ctx, "%s/smb.XXXXXX", @@ -42,7 +44,9 @@ static int setup_out_fd(void) } /* now create the file */ + mask = umask(S_IRWXO | S_IRWXG); fd = mkstemp(path); + umask(mask); if (fd == -1) { DEBUG(0,("setup_out_fd: Failed to create file %s. (%s)\n", -- cgit