git.samba.org
/
mat
/
samba.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Make sure to set umask() before calling mkstemp().
[mat/samba.git]
/
lib
/
util
/
util.c
diff --git
a/lib/util/util.c
b/lib/util/util.c
index d49e20e6cd5f99bc4b74edf5d8e3062d34ccfb18..464fc62e1fb20a7d176130edc8d205ec097c9349 100644
(file)
--- a/
lib/util/util.c
+++ b/
lib/util/util.c
@@
-63,6
+63,7
@@
int create_unlink_tmp(const char *dir)
{
char *fname;
int fd;
+ mode_t mask;
if (!dir) {
dir = tmpdir();
@@
-73,7
+74,9
@@
int create_unlink_tmp(const char *dir)
errno = ENOMEM;
return -1;
}
+ mask = umask(S_IRWXO | S_IRWXG);
fd = mkstemp(fname);
+ umask(mask);
if (fd == -1) {
TALLOC_FREE(fname);
return -1;