dovecot-1.1: deliver didn't expand %variables in namespace locat...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jul 12 15:49:06 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/33b842ef38b6
changeset: 7743:33b842ef38b6
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jul 12 15:49:01 2008 +0300
description:
deliver didn't expand %variables in namespace location settings.

diffstat:

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

diffs (46 lines):

diff -r 0332fc5a2041 -r 33b842ef38b6 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Sat Jul 12 02:14:26 2008 +0300
+++ b/src/deliver/deliver.c	Sat Jul 12 15:49:01 2008 +0300
@@ -694,7 +694,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;
+	const char *mail_env, *const *envs, *home, *env_name;
 	unsigned int i, count;
 	string_t *str;
 
@@ -713,16 +713,26 @@ static void expand_envs(const char *user
 	for (i = 0; i < count; i++)
 		env_put(envs[i]);
 
+	/* get the table again in case plugin envs provided the home
+	   directory (yea, kludgy) */
+	if (home == NULL)
+		home = getenv("HOME");
+	table = get_var_expand_table(user, home);
+
 	mail_env = getenv("MAIL_LOCATION");
-	if (mail_env != NULL) {
-		/* get the table again in case plugin envs provided the home
-		   directory (yea, kludgy) */
-		if (home == NULL)
-			home = getenv("HOME");
-		table = get_var_expand_table(user, home);
+	if (mail_env != NULL)
 		mail_env = expand_mail_env(mail_env, table);
-	}
 	env_put(t_strconcat("MAIL=", mail_env, NULL));
+
+	for (i = 1;; i++) {
+		env_name = t_strdup_printf("NAMESPACE_%u", i);
+		mail_env = getenv(env_name);
+		if (mail_env == NULL)
+			break;
+
+		mail_env = expand_mail_env(mail_env, table);
+		env_put(t_strconcat(env_name, "=", mail_env, NULL));
+	}
 }
 
 static void putenv_extra_fields(ARRAY_TYPE(string) *extra_fields)


More information about the dovecot-cvs mailing list