diff options
author | Andreas Schneider <asn@samba.org> | 2013-02-25 17:34:21 +0100 |
---|---|---|
committer | David Disseldorp <ddiss@samba.org> | 2013-03-06 01:16:34 +0100 |
commit | 90cbfc96d118d6b55c47392d8ae421434dea8225 (patch) | |
tree | 8d0c24d3e5241daaadda579acf13fe90c399b632 /source3/utils | |
parent | 7a50f089e0ae70ec7652575e11fbf87a9f6a86e7 (diff) | |
download | samba-90cbfc96d118d6b55c47392d8ae421434dea8225.tar.gz samba-90cbfc96d118d6b55c47392d8ae421434dea8225.tar.bz2 samba-90cbfc96d118d6b55c47392d8ae421434dea8225.zip |
Make sure to set umask() before calling mkstemp().
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Wed Mar 6 01:16:34 CET 2013 on sn-devel-104
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/interact.c | 7 | ||||
-rw-r--r-- | source3/utils/net_usershare.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/source3/utils/interact.c b/source3/utils/interact.c index 6d753dd012..f8fed6de19 100644 --- a/source3/utils/interact.c +++ b/source3/utils/interact.c @@ -25,6 +25,7 @@ */ #include "includes.h" +#include "system/filesys.h" #include "interact.h" @@ -79,8 +80,12 @@ char* interact_edit(TALLOC_CTX* mem_ctx, const char* str) { char buf[128]; char* ret = NULL; FILE* file; + mode_t mask; + int fd; - int fd = mkstemp(fname); + mask = umask(S_IRWXO | S_IRWXG); + fd = mkstemp(fname); + umask(mask); if (fd == -1) { DEBUG(0, ("failed to mkstemp %s: %s\n", fname, strerror(errno))); diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index 382fe2f250..78d38daaf9 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -642,6 +642,7 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv) uid_t myeuid = geteuid(); bool guest_ok = false; int num_usershares; + mode_t mask; us_comment = ""; arg_acl = "S-1-1-0:R"; @@ -895,7 +896,9 @@ static int net_usershare_add(struct net_context *c, int argc, const char **argv) } /* Create a temporary filename for this share. */ + mask = umask(S_IRWXO | S_IRWXG); tmpfd = mkstemp(full_path_tmp); + umask(mask); if (tmpfd == -1) { d_fprintf(stderr, |