changeset 9078:7ee8a3ea7b37 HEAD

dump-capability fix.
author Timo Sirainen <tss@iki.fi>
date Sat, 11 Apr 2009 23:23:22 -0400
parents e77f2df8c666
children a817f39d255f
files src/master/mail-process.c
diffstat 1 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	return tab;
 }
 
-static void mail_process_set_environment(struct master_settings *set)
+static void mail_process_set_environment(struct master_settings *set,
+					 bool dump_capability)
 {
-	/* 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 (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;
 
-	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));
+		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 @@
 		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 @@
 			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);