dovecot-1.1: deliver: Expand variables in namespace prefix.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 16 12:47:33 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/533fef6eacfd
changeset: 7937:533fef6eacfd
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 16 12:47:29 2008 +0300
description:
deliver: Expand variables in namespace prefix.

diffstat:

1 file changed, 17 insertions(+), 9 deletions(-)
src/deliver/deliver.c |   26 +++++++++++++++++---------

diffs (48 lines):

diff -r 82d4756f43cc -r 533fef6eacfd src/deliver/deliver.c
--- a/src/deliver/deliver.c	Thu Oct 16 12:38:25 2008 +0300
+++ b/src/deliver/deliver.c	Thu Oct 16 12:47:29 2008 +0300
@@ -725,7 +725,7 @@ static void expand_envs(const char *user
 static void expand_envs(const char *user)
 {
         const struct var_expand_table *table;
-	const char *mail_env, *const *envs, *home, *env_name;
+	const char *value, *const *envs, *home, *env_name;
 	unsigned int i, count;
 	string_t *str;
 
@@ -750,19 +750,27 @@ static void expand_envs(const char *user
 		home = getenv("HOME");
 	table = get_var_expand_table(user, home);
 
-	mail_env = getenv("MAIL_LOCATION");
-	if (mail_env != NULL)
-		mail_env = expand_mail_env(mail_env, table);
-	env_put(t_strconcat("MAIL=", mail_env, NULL));
+	value = getenv("MAIL_LOCATION");
+	if (value != NULL)
+		value = expand_mail_env(value, table);
+	env_put(t_strconcat("MAIL=", value, NULL));
 
 	for (i = 1;; i++) {
 		env_name = t_strdup_printf("NAMESPACE_%u", i);
-		mail_env = getenv(env_name);
-		if (mail_env == NULL)
+		value = getenv(env_name);
+		if (value == NULL)
 			break;
 
-		mail_env = expand_mail_env(mail_env, table);
-		env_put(t_strconcat(env_name, "=", mail_env, NULL));
+		value = expand_mail_env(value, table);
+		env_put(t_strconcat(env_name, "=", value, NULL));
+
+		env_name = t_strdup_printf("NAMESPACE_%u_PREFIX", i);
+		value = getenv(env_name);
+		if (value != NULL) {
+			str_truncate(str, 0);
+			var_expand(str, value, table);
+			env_put(t_strconcat(env_name, "=", str_c(str), NULL));
+		}
 	}
 }
 


More information about the dovecot-cvs mailing list