[dovecot-cvs] dovecot/src/master mail-process.c,1.97,1.98

tss-movial at dovecot.org tss-movial at dovecot.org
Mon Jun 12 15:46:17 EEST 2006


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

Modified Files:
	mail-process.c 
Log Message:
dovecot --exec-mail ext <binary path> now reads the default settings from
configuration file, puts them to environment and executes the given binary.



Index: mail-process.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/master/mail-process.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- mail-process.c	8 Jun 2006 16:57:26 -0000	1.97
+++ mail-process.c	12 Jun 2006 12:46:15 -0000	1.98
@@ -307,22 +307,32 @@
 	struct server_settings *server = settings_root;
 	const struct var_expand_table *var_expand_table;
 	struct settings *set;
+	const char *executable;
 
-	if (section != NULL) {
-		for (; server != NULL; server = server->next) {
-			if (strcmp(server->name, section) == 0)
-				break;
+	if (strcmp(protocol, "ext") == 0) {
+		/* external binary. section contains path for it. */
+		if (section == NULL)
+			i_fatal("External binary parameter not given");
+		set = server->defaults;
+		executable = section;
+	} else {
+		if (section != NULL) {
+			for (; server != NULL; server = server->next) {
+				if (strcmp(server->name, section) == 0)
+					break;
+			}
+			if (server == NULL)
+				i_fatal("Section not found: '%s'", section);
 		}
-		if (server == NULL)
-			i_fatal("Section not found: '%s'", section);
-	}
 
-	if (strcmp(protocol, "imap") == 0)
-		set = server->imap;
-	else if (strcmp(protocol, "pop3") == 0)
-		set = server->pop3;
-	else
-		i_fatal("Unknown protocol: '%s'", protocol);
+		if (strcmp(protocol, "imap") == 0)
+			set = server->imap;
+		else if (strcmp(protocol, "pop3") == 0)
+			set = server->pop3;
+		else
+			i_fatal("Unknown protocol: '%s'", protocol);
+		executable = set->mail_executable;
+	}
 
 	var_expand_table =
 		get_var_expand_table(protocol, getenv("USER"), getenv("HOME"),
@@ -331,10 +341,9 @@
 				     getpid(), geteuid());
 
 	mail_process_set_environment(set, getenv("MAIL"), var_expand_table);
-        client_process_exec(set->mail_executable, "");
+        client_process_exec(executable, "");
 
-	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m",
-		       set->mail_executable);
+	i_fatal_status(FATAL_EXEC, "execv(%s) failed: %m", executable);
 }
 
 static void nfs_warn_if_found(const char *mail, const char *home)



More information about the dovecot-cvs mailing list