dovecot-1.2: safe_mkstemp()'s mode parameter didn't override uma...
dovecot at dovecot.org
dovecot at dovecot.org
Fri May 1 19:30:14 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/5302ce189a70
changeset: 9001:5302ce189a70
user: Timo Sirainen <tss at iki.fi>
date: Fri May 01 12:30:07 2009 -0400
description:
safe_mkstemp()'s mode parameter didn't override umask as it was supposed to.
diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
src/lib/safe-mkstemp.c | 5 ++++-
diffs (22 lines):
diff -r b02c642b4e51 -r 5302ce189a70 src/lib/safe-mkstemp.c
--- a/src/lib/safe-mkstemp.c Thu Apr 30 20:22:49 2009 -0400
+++ b/src/lib/safe-mkstemp.c Fri May 01 12:30:07 2009 -0400
@@ -16,6 +16,7 @@ int safe_mkstemp(string_t *prefix, mode_
size_t prefix_len;
struct stat st;
unsigned char randbuf[8];
+ mode_t old_umask;
int fd;
prefix_len = str_len(prefix);
@@ -32,7 +33,9 @@ int safe_mkstemp(string_t *prefix, mode_
return -1;
}
- fd = open(str_c(prefix), O_RDWR | O_EXCL | O_CREAT, mode);
+ old_umask = umask(0666 ^ mode);
+ fd = open(str_c(prefix), O_RDWR | O_EXCL | O_CREAT, 0666);
+ umask(old_umask);
if (fd != -1)
break;
More information about the dovecot-cvs
mailing list