dovecot-1.2: master: Create base_dir with 0755 permissions, not ...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Nov 20 00:59:33 EET 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/3ebbccdc05e6
changeset: 9478:3ebbccdc05e6
user: Timo Sirainen <tss at iki.fi>
date: Thu Nov 19 17:59:29 2009 -0500
description:
master: Create base_dir with 0755 permissions, not 0777.
diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
src/master/master-settings.c | 10 +++++++++-
diffs (27 lines):
diff -r 96b5d6d8dd2c -r 3ebbccdc05e6 src/master/master-settings.c
--- a/src/master/master-settings.c Thu Nov 12 12:43:13 2009 -0500
+++ b/src/master/master-settings.c Thu Nov 19 17:59:29 2009 -0500
@@ -975,7 +975,7 @@ static bool settings_do_fixes(struct set
/* since base dir is under /var/run by default, it may have been
deleted. */
- if (mkdir_parents(set->base_dir, 0777) < 0 && errno != EEXIST) {
+ if (mkdir_parents(set->base_dir, 0755) < 0 && errno != EEXIST) {
i_error("mkdir(%s) failed: %m", set->base_dir);
return FALSE;
}
@@ -983,6 +983,14 @@ static bool settings_do_fixes(struct set
if (stat(set->base_dir, &st) < 0) {
i_error("stat(%s) failed: %m", set->base_dir);
return FALSE;
+ }
+ if ((st.st_mode & 0777) == 0777) {
+ /* FIXME: backwards compatibility: v1.2 was creating
+ base_dir with 0777 permissions.. */
+ i_warning("Fixing permissions of %s to be world-readable",
+ set->base_dir);
+ if (chmod(set->base_dir, 0755) < 0)
+ i_error("chmod(%s) failed: %m", set->base_dir);
}
/* remove auth worker sockets left by unclean exits */
More information about the dovecot-cvs
mailing list