dovecot-1.2: deliver: Allow lda section to override plugin setti...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 8 15:21:07 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/afc0d1197fe8
changeset: 7974:afc0d1197fe8
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 08 17:50:29 2008 +0530
description:
deliver: Allow lda section to override plugin settings.

diffstat:

1 file changed, 11 insertions(+), 1 deletion(-)
src/deliver/deliver.c |   12 +++++++++++-

diffs (43 lines):

diff -r 6ccb546b9615 -r afc0d1197fe8 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Tue Jul 08 17:49:24 2008 +0530
+++ b/src/deliver/deliver.c	Tue Jul 08 17:50:29 2008 +0530
@@ -67,6 +67,7 @@ static struct ioloop *ioloop;
 static struct ioloop *ioloop;
 
 static pool_t plugin_pool;
+static ARRAY_DEFINE(lda_envs, const char *);
 static ARRAY_DEFINE(plugin_envs, const char *);
 
 static void sig_die(int signo, void *context ATTR_UNUSED)
@@ -298,6 +299,7 @@ static void config_file_init(const char 
 	size_t len;
 
 	plugin_pool = pool_alloconly_create("Plugin strings", 512);
+	i_array_init(&lda_envs, 16);
 	i_array_init(&plugin_envs, 16);
 
 	fd = open(path, O_RDONLY);
@@ -436,7 +438,11 @@ static void config_file_init(const char 
 			continue;
 		}
 
-		if (!plugin_section) {
+		if (lda_section) {
+			value = p_strconcat(plugin_pool,
+					    t_str_ucase(key), "=", value, NULL);
+			array_append(&lda_envs, &value, 1);
+		} else if (!plugin_section) {
 			env_put(t_strconcat(t_str_ucase(key), "=",
 					    value, NULL));
 		} else {
@@ -702,6 +708,10 @@ static void expand_envs(const char *user
 		var_expand(str, envs[i], table);
 		env_put(str_c(str));
 	}
+	/* add LDA envs last so that they can override plugin settings */
+	envs = array_get(&lda_envs, &count);
+	for (i = 0; i < count; i++)
+		env_put(envs[i]);
 
 	mail_env = getenv("MAIL_LOCATION");
 	if (mail_env != NULL) {


More information about the dovecot-cvs mailing list