[dovecot-cvs] dovecot/src/master main.c, 1.80.2.13, 1.80.2.14 master-settings.c, 1.125.2.20, 1.125.2.21 master-settings.h, 1.83.2.6, 1.83.2.7

tss at dovecot.org tss at dovecot.org
Thu Dec 28 15:06:31 UTC 2006


Update of /var/lib/cvs/dovecot/src/master
In directory talvi:/tmp/cvs-serv30108

Modified Files:
      Tag: branch_1_0
	main.c master-settings.c master-settings.h 
Log Message:
-n and -a parameters shouldn't be deleting auth sockets.



Index: main.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/main.c,v
retrieving revision 1.80.2.13
retrieving revision 1.80.2.14
diff -u -d -r1.80.2.13 -r1.80.2.14
--- main.c	13 Oct 2006 23:50:07 -0000	1.80.2.13
+++ main.c	28 Dec 2006 15:06:28 -0000	1.80.2.14
@@ -139,7 +139,7 @@
         auth_processes_destroy_all();
         dict_process_kill();
 
-	if (!master_settings_read(configfile, FALSE))
+	if (!master_settings_read(configfile, FALSE, FALSE))
 		i_warning("Invalid configuration, keeping old one");
 	else {
 		if (!IS_INETD()) {
@@ -751,7 +751,7 @@
 			if (i == argc) i_fatal("Missing config file argument");
 			configfile = argv[i];
 		} else if (strcmp(argv[i], "-n") == 0) {
-			dump_config_nondefaults = TRUE;
+			dump_config_nondefaults = dump_config = TRUE;
 		} else if (strcmp(argv[i], "-p") == 0) {
 			/* Ask SSL private key password */
 			ask_key_pass = TRUE;
@@ -784,7 +784,7 @@
 		foreground = TRUE;
 	}
 
-	if (dump_config || dump_config_nondefaults) {
+	if (dump_config) {
 		/* print the config file path before parsing it, so in case
 		   of errors it's still shown */
 		printf("# %s\n", configfile);
@@ -793,11 +793,12 @@
 	/* read and verify settings before forking */
 	t_push();
 	master_settings_init();
-	if (!master_settings_read(configfile, exec_protocol != NULL))
+	if (!master_settings_read(configfile, exec_protocol != NULL,
+				  dump_config))
 		exit(FATAL_DEFAULT);
 	t_pop();
 
-	if (dump_config || dump_config_nondefaults) {
+	if (dump_config) {
 		master_settings_dump(settings_root, dump_config_nondefaults);
 		return 0;
 	}

Index: master-settings.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.c,v
retrieving revision 1.125.2.20
retrieving revision 1.125.2.21
diff -u -d -r1.125.2.20 -r1.125.2.21
--- master-settings.c	28 Dec 2006 12:26:42 -0000	1.125.2.20
+++ master-settings.c	28 Dec 2006 15:06:28 -0000	1.125.2.21
@@ -591,7 +591,6 @@
 static bool settings_verify(struct settings *set)
 {
 	const char *dir;
-	struct stat st;
 	int facility;
 
 	if (!get_login_uid(set))
@@ -653,6 +652,63 @@
 	}
 #endif
 
+	if (set->max_mail_processes < 1) {
+		i_error("max_mail_processes must be at least 1");
+		return FALSE;
+	}
+
+	if (set->last_valid_uid != 0 &&
+	    set->first_valid_uid > set->last_valid_uid) {
+		i_error("first_valid_uid can't be larger than last_valid_uid");
+		return FALSE;
+	}
+	if (set->last_valid_gid != 0 &&
+	    set->first_valid_gid > set->last_valid_gid) {
+		i_error("first_valid_gid can't be larger than last_valid_gid");
+		return FALSE;
+	}
+	if (set->mail_drop_priv_before_exec && *set->mail_chroot != '\0') {
+		i_error("mail_drop_priv_before_exec=yes and mail_chroot "
+			"don't work together");
+		return FALSE;
+	}
+
+	if (access(t_strcut(set->login_executable, ' '), X_OK) < 0) {
+		i_error("Can't use login executable %s: %m",
+			t_strcut(set->login_executable, ' '));
+		return FALSE;
+	}
+
+	if (set->login_processes_count < 1) {
+		i_error("login_processes_count must be at least 1");
+		return FALSE;
+	}
+	if (set->login_max_connections < 1) {
+		i_error("login_max_connections must be at least 1");
+		return FALSE;
+	}
+
+#ifdef HAVE_MODULES
+	if (*set->mail_plugins != '\0' &&
+	    access(set->mail_plugin_dir, R_OK | X_OK) < 0) {
+		i_error("Can't access mail module directory: %s: %m",
+			set->mail_plugin_dir);
+		return FALSE;
+	}
+#else
+	if (*set->mail_plugins != '\0') {
+		i_error("Module support wasn't built into Dovecot, "
+			"can't load modules: %s", set->mail_plugins);
+		return FALSE;
+	}
+#endif
+	return TRUE;
+}
+
+static bool settings_do_fixes(struct settings *set)
+{
+	struct stat st;
+
 	/* since base dir is under /var/run by default, it may have been
 	   deleted. */
 	if (mkdir_parents(set->base_dir, 0777) < 0 && errno != EEXIST) {
@@ -699,65 +755,17 @@
 		unlink_auth_sockets(set->login_dir);
 	}
 
-	if (set->max_mail_processes < 1) {
-		i_error("max_mail_processes must be at least 1");
-		return FALSE;
-	}
-
-	if (set->last_valid_uid != 0 &&
-	    set->first_valid_uid > set->last_valid_uid) {
-		i_error("first_valid_uid can't be larger than last_valid_uid");
-		return FALSE;
-	}
-	if (set->last_valid_gid != 0 &&
-	    set->first_valid_gid > set->last_valid_gid) {
-		i_error("first_valid_gid can't be larger than last_valid_gid");
-		return FALSE;
-	}
-	if (set->mail_drop_priv_before_exec && *set->mail_chroot != '\0') {
-		i_error("mail_drop_priv_before_exec=yes and mail_chroot "
-			"don't work together");
-		return FALSE;
-	}
-
-	if (access(t_strcut(set->login_executable, ' '), X_OK) < 0) {
-		i_error("Can't use login executable %s: %m",
-			t_strcut(set->login_executable, ' '));
-		return FALSE;
-	}
-
-	if (set->login_processes_count < 1) {
-		i_error("login_processes_count must be at least 1");
-		return FALSE;
-	}
-	if (set->login_max_connections < 1) {
-		i_error("login_max_connections must be at least 1");
-		return FALSE;
-	}
-
 #ifdef HAVE_MODULES
-	if (*set->mail_plugins != '\0' &&
-	    access(set->mail_plugin_dir, R_OK | X_OK) < 0) {
-		i_error("Can't access mail module directory: %s: %m",
-			set->mail_plugin_dir);
-		return FALSE;
-	}
 	if (*set->mail_plugins != '\0' && set->protocol == MAIL_PROTOCOL_IMAP &&
 	    *set->imap_capability == '\0') {
 		if (!get_imap_capability(set))
 			return FALSE;
 	}
-#else
-	if (*set->mail_plugins != '\0') {
-		i_error("Module support wasn't built into Dovecot, "
-			"can't load modules: %s", set->mail_plugins);
-		return FALSE;
-	}
 #endif
 	return TRUE;
 }
 
-static bool settings_fix(struct settings *set, bool nochecks)
+static bool settings_fix(struct settings *set, bool nochecks, bool nofixes)
 {
 	/* fix relative paths */
 	fix_base_path(set, &set->login_dir);
@@ -770,7 +778,11 @@
 			"Use only one of them.");
 		return FALSE;
 	}
-	return nochecks ? TRUE : settings_verify(set);
+	if (nochecks)
+		return TRUE;
+	if (!settings_verify(set))
+		return FALSE;
+	return nofixes ? TRUE : settings_do_fixes(set);
 }
 
 static struct auth_settings *
@@ -1217,7 +1229,7 @@
 	return FALSE;
 }
 
-bool master_settings_read(const char *path, bool nochecks)
+bool master_settings_read(const char *path, bool nochecks, bool nofixes)
 {
 	struct settings_parse_ctx ctx;
 	struct server_settings *server, *prev;
@@ -1257,13 +1269,14 @@
 		}
 		if (!settings_is_active(server->imap)) {
 			if (strcmp(server->imap->protocols, "none") == 0) {
-				if (!settings_fix(server->imap, nochecks))
+				if (!settings_fix(server->imap, nochecks,
+						  nofixes))
 					return FALSE;
 				server->defaults = server->imap;
 			}
 			server->imap = NULL;
 		} else {
-			if (!settings_fix(server->imap, nochecks))
+			if (!settings_fix(server->imap, nochecks, nofixes))
 				return FALSE;
 			server->defaults = server->imap;
 		}
@@ -1271,7 +1284,7 @@
 		if (!settings_is_active(server->pop3))
 			server->pop3 = NULL;
 		else {
-			if (!settings_fix(server->pop3, nochecks))
+			if (!settings_fix(server->pop3, nochecks, nofixes))
 				return FALSE;
 			if (server->defaults == NULL)
 				server->defaults = server->pop3;

Index: master-settings.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/master-settings.h,v
retrieving revision 1.83.2.6
retrieving revision 1.83.2.7
diff -u -d -r1.83.2.6 -r1.83.2.7
--- master-settings.h	22 Dec 2006 14:20:31 -0000	1.83.2.6
+++ master-settings.h	28 Dec 2006 15:06:28 -0000	1.83.2.7
@@ -233,7 +233,7 @@
 
 extern struct server_settings *settings_root;
 
-bool master_settings_read(const char *path, bool nochecks);
+bool master_settings_read(const char *path, bool nochecks, bool nofixes);
 
 void master_settings_dump(struct server_settings *set, bool nondefaults);
 



More information about the dovecot-cvs mailing list