[dovecot-cvs] dovecot/src/master main.c, 1.95, 1.96 master-settings.c, 1.149, 1.150 master-settings.h, 1.91, 1.92

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


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

Modified Files:
	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.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- main.c	15 Dec 2006 16:55:50 -0000	1.95
+++ main.c	28 Dec 2006 15:06:31 -0000	1.96
@@ -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()) {
@@ -752,7 +752,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;
@@ -785,7 +785,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);
@@ -794,11 +794,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.149
retrieving revision 1.150
diff -u -d -r1.149 -r1.150
--- master-settings.c	28 Dec 2006 12:26:47 -0000	1.149
+++ master-settings.c	28 Dec 2006 15:06:31 -0000	1.150
@@ -592,7 +592,6 @@
 static bool settings_verify(struct settings *set)
 {
 	const char *dir;
-	struct stat st;
 	int facility;
 
 	if (!get_login_uid(set))
@@ -654,6 +653,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) {
@@ -700,65 +756,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);
@@ -771,7 +779,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 *
@@ -1214,7 +1226,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;
@@ -1254,13 +1266,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;
 		}
@@ -1268,7 +1281,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.91
retrieving revision 1.92
diff -u -d -r1.91 -r1.92
--- master-settings.h	22 Dec 2006 14:20:40 -0000	1.91
+++ master-settings.h	28 Dec 2006 15:06:31 -0000	1.92
@@ -234,7 +234,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