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/printing/printspoolss.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source3/printing/printspoolss.c') diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c index acf4c0d19a..5fab7d54ef 100644 --- a/source3/printing/printspoolss.c +++ b/source3/printing/printspoolss.c @@ -18,6 +18,7 @@ */ #include "includes.h" +#include "system/filesys.h" #include "printing.h" #include "rpc_client/rpc_client.h" #include "../librpc/gen_ndr/ndr_spoolss_c.h" @@ -68,6 +69,7 @@ NTSTATUS print_spool_open(files_struct *fsp, struct spoolss_DocumentInfo1 *info1; int fd = -1; WERROR werr; + mode_t mask; tmp_ctx = talloc_new(fsp); if (!tmp_ctx) { @@ -127,7 +129,9 @@ NTSTATUS print_spool_open(files_struct *fsp, goto done; } errno = 0; + mask = umask(S_IRWXO | S_IRWXG); fd = mkstemp(pf->filename); + umask(mask); if (fd == -1) { if (errno == EACCES) { /* Common setup error, force a report. */ -- cgit