dovecot-2.0-sslstream: master: Create base_dir with 0755 permiss...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:56:36 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/17eac5a18ce4
changeset: 10375:17eac5a18ce4
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Nov 19 18:00:08 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 036db604f86c -r 17eac5a18ce4 src/master/master-settings.c
--- a/src/master/master-settings.c	Thu Nov 19 17:28:48 2009 -0500
+++ b/src/master/master-settings.c	Thu Nov 19 18:00:08 2009 -0500
@@ -471,7 +471,7 @@ bool master_settings_do_fixes(const stru
 
 	/* 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;
 	}
@@ -483,6 +483,14 @@ bool master_settings_do_fixes(const stru
 	if (!S_ISDIR(st.st_mode)) {
 		i_error("%s is not a directory", 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);
 	}
 
 	/* Make sure our permanent state directory exists */


More information about the dovecot-cvs mailing list