From: Timo Sirainen Date: Sat, 12 Jul 2008 12:49:01 +0000 (+0300) Subject: deliver didn't expand %variables in namespace location settings. X-Git-Tag: 1.2.alpha1~166 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=20c5991763bbc6a4bbddd7420074b9b335fc8113;p=thirdparty%2Fdovecot%2Fcore.git deliver didn't expand %variables in namespace location settings. --HG-- branch : HEAD --- diff --git a/src/deliver/deliver.c b/src/deliver/deliver.c index 7b176a11d6..0773e419aa 100644 --- a/src/deliver/deliver.c +++ b/src/deliver/deliver.c @@ -694,7 +694,7 @@ void deliver_env_clean(void) 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)