dovecot-1.3: dump-capability fix.

dovecot at dovecot.org dovecot at dovecot.org
Sun Apr 12 06:34:32 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.3/rev/7ee8a3ea7b37
changeset: 9078:7ee8a3ea7b37
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Apr 11 23:23:22 2009 -0400
description:
dump-capability fix.

diffstat:

1 file changed, 24 insertions(+), 13 deletions(-)
src/master/mail-process.c |   37 ++++++++++++++++++++++++-------------

diffs (61 lines):

diff -r e77f2df8c666 -r 7ee8a3ea7b37 src/master/mail-process.c
--- a/src/master/mail-process.c	Sat Apr 11 23:12:48 2009 -0400
+++ b/src/master/mail-process.c	Sat Apr 11 23:23:22 2009 -0400
@@ -207,17 +207,28 @@ get_var_expand_table(const char *protoco
 	return tab;
 }
 
-static void mail_process_set_environment(struct master_settings *set)
-{
-	/* we don't know all the settings, so since we can't expand all of
-	   them just let the mail process expand all of them internally. */
-	master_settings_export_to_env(set);
-
-	if (set->maildir_very_dirty_syncs)
-		env_put("MAILDIR_VERY_DIRTY_SYNCS=1");
-	(void)umask(0077);
-	env_put(t_strdup_printf("DBOX_PURGE_MIN_PERCENTAGE=%u",
-				set->dbox_purge_min_percentage));
+static void mail_process_set_environment(struct master_settings *set,
+					 bool dump_capability)
+{
+	if (dump_capability) {
+		/* the only settings we need to have are what plugins to load
+		   and from where. the rest will only make the dump-capability
+		   more likely to fail. */
+		const char *const *sets;
+		unsigned int i, count;
+
+		env_put("MAIL=raw:/tmp");
+		sets = array_get(&set->all_settings, &count);
+		for (i = 0; i < count; i++) {
+			if (strncmp(sets[i], "mail_plugin", 11) == 0)
+				env_put(sets[i]);
+		}
+	} else {
+		/* we don't know all the settings, so since we can't expand all
+		   of them just let the mail process expand all of them
+		   internally. */
+		master_settings_export_to_env(set);
+	}
 }
 
 void mail_process_exec(const char *protocol, const char **args)
@@ -265,7 +276,7 @@ void mail_process_exec(const char *proto
 		env_put(str_c(str));
 	}
 
-	mail_process_set_environment(set);
+	mail_process_set_environment(set, FALSE);
 	if (args == NULL)
 		client_process_exec(executable, "");
 	else
@@ -554,7 +565,7 @@ create_mail_process(enum process_type pr
 			i_fatal("chdir(/tmp) failed: %m");
 	}
 
-	mail_process_set_environment(set);
+	mail_process_set_environment(set, dump_capability);
 
 	/* extra args. uppercase key value. */
 	expanded_vars = t_str_new(128);


More information about the dovecot-cvs mailing list