changeset 5665:1680709ec0a2 HEAD

Don't expand %variables in mail setting coming from userdb.
author Timo Sirainen <tss@iki.fi>
date Sun, 27 May 2007 16:45:27 +0300
parents b796701a6927
children a0e59849a03d
files src/deliver/deliver.c
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Fri May 25 18:17:54 2007 +0300
+++ b/src/deliver/deliver.c	Sun May 27 16:45:27 2007 +0300
@@ -665,19 +665,22 @@
 	mailbox_list_register_all();
 
 	/* MAIL comes from userdb, MAIL_LOCATION from dovecot.conf.
+	   We don't want to expand settings coming from userdb.
 	   FIXME: should remove these and support namespaces.. */
 	mail_env = getenv("MAIL");
-	if (mail_env == NULL) 
+	if (mail_env == NULL)  {
 		mail_env = getenv("MAIL_LOCATION");
-	if (mail_env == NULL)  {
-		/* Keep this for backwards compatibility */
-		mail_env = getenv("DEFAULT_MAIL_ENV");
+		if (mail_env == NULL)  {
+			/* Keep this for backwards compatibility */
+			mail_env = getenv("DEFAULT_MAIL_ENV");
+		}
+		if (mail_env != NULL) {
+			table = get_var_expand_table(destination,
+						     getenv("HOME"));
+			mail_env = expand_mail_env(mail_env, table);
+		}
+		env_put(t_strconcat("MAIL=", mail_env, NULL));
 	}
-	if (mail_env != NULL) {
-		table = get_var_expand_table(destination, getenv("HOME"));
-		mail_env = expand_mail_env(mail_env, table);
-	}
-	env_put(t_strconcat("MAIL=", mail_env, NULL));
 
 	module_dir_init(modules);