dovecot: Fixed home directory handling which got broken by previ...

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 9 03:59:30 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/6bd13d514294
changeset: 6358:6bd13d514294
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Sep 09 03:58:57 2007 +0300
description:
Fixed home directory handling which got broken by previous changes.

diffstat:

2 files changed, 11 insertions(+), 3 deletions(-)
src/deliver/auth-client.c |    4 ++++
src/deliver/deliver.c     |   10 +++++++---

diffs (45 lines):

diff -r a445f128744e -r 6bd13d514294 src/deliver/auth-client.c
--- a/src/deliver/auth-client.c	Sat Sep 08 03:50:25 2007 +0300
+++ b/src/deliver/auth-client.c	Sun Sep 09 03:58:57 2007 +0300
@@ -90,6 +90,10 @@ static void auth_parse_input(struct auth
 			chroot = *tmp + 7;
 		} else {
 			char *field = i_strdup(*tmp);
+
+			if (strncmp(field, "home=", 5) == 0)
+				env_put(t_strconcat("HOME=", field + 5, NULL));
+
 			array_append(conn->extra_fields, &field, 1);
 		}
 	}
diff -r a445f128744e -r 6bd13d514294 src/deliver/deliver.c
--- a/src/deliver/deliver.c	Sat Sep 08 03:50:25 2007 +0300
+++ b/src/deliver/deliver.c	Sun Sep 09 03:58:57 2007 +0300
@@ -516,12 +516,14 @@ static void expand_envs(const char *dest
 static void expand_envs(const char *destination)
 {
         const struct var_expand_table *table;
-	const char *mail_env, *const *envs;
+	const char *mail_env, *const *envs, *home;
 	unsigned int i, count;
 	string_t *str;
 
+	home = getenv("HOME");
+
 	str = t_str_new(256);
-	table = get_var_expand_table(destination, getenv("HOME"));
+	table = get_var_expand_table(destination, home);
 	envs = array_get(&plugin_envs, &count);
 	for (i = 0; i < count; i++) {
 		str_truncate(str, 0);
@@ -533,7 +535,9 @@ static void expand_envs(const char *dest
 	if (mail_env != NULL) {
 		/* get the table again in case plugin envs provided the home
 		   directory (yea, kludgy) */
-		table = get_var_expand_table(destination, getenv("HOME"));
+		if (home == NULL)
+			home = getenv("HOME");
+		table = get_var_expand_table(destination, home);
 		mail_env = expand_mail_env(mail_env, table);
 	}
 	env_put(t_strconcat("MAIL=", mail_env, NULL));


More information about the dovecot-cvs mailing list