From: Philip Hazel Date: Tue, 27 Jun 2006 15:38:07 +0000 (+0000) Subject: Magnus Holmgren's patch to fix non-expanding transport home directory X-Git-Tag: exim-4_63~37 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/5418e93b01f7308b0f86ec8b5068d0ae71c7ddd0 Magnus Holmgren's patch to fix non-expanding transport home directory bug. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 9a2d9c83c..fe529c45b 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.360 2006/06/27 15:07:18 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.361 2006/06/27 15:38:07 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -45,6 +45,10 @@ PH/03 Magnus Holmgren's patch for filter_prepend_home. PH/03 Fixed Bugzilla #101: macro definition between ACLs doesn't work. +PH/04 Applied Magnus Holmgren's patch to fix Bugzilla #98: transport's home + directory not expanded when it should be if an expanded home directory + was set for the address (which is overridden by the transport). + Exim version 4.62 ----------------- diff --git a/src/src/deliver.c b/src/src/deliver.c index a80d97842..e40ed6828 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/deliver.c,v 1.31 2006/04/20 14:11:29 ph10 Exp $ */ +/* $Cambridge: exim/src/src/deliver.c,v 1.32 2006/06/27 15:38:07 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1626,17 +1626,13 @@ return. */ if (!findugid(addr, tp, &uid, &gid, &use_initgroups)) return; -/* See if either the transport or the address specifies a home and/or a current -working directory. Expand it if necessary. If nothing is set, use "/", for the -working directory, which is assumed to be a directory to which all users have -access. It is necessary to be in a visible directory for some operating systems -when running pipes, as some commands (e.g. "rm" under Solaris 2.5) require -this. */ +/* See if either the transport or the address specifies a home directory. A +home directory set in the address may already be expanded; a flag is set to +indicate that. In other cases we must expand it. */ -deliver_home = (tp->home_dir != NULL)? tp->home_dir : - (addr->home_dir != NULL)? addr->home_dir : NULL; - -if (deliver_home != NULL && !testflag(addr, af_home_expanded)) +if ((deliver_home = tp->home_dir) != NULL || /* Set in transport, or */ + ((deliver_home = addr->home_dir) != NULL && /* Set in address and */ + !testflag(addr, af_home_expanded))) /* not expanded */ { uschar *rawhome = deliver_home; deliver_home = NULL; /* in case it contains $home */ @@ -1656,8 +1652,15 @@ if (deliver_home != NULL && !testflag(addr, af_home_expanded)) } } -working_directory = (tp->current_dir != NULL)? tp->current_dir : - (addr->current_dir != NULL)? addr->current_dir : NULL; +/* See if either the transport or the address specifies a current directory, +and if so, expand it. If nothing is set, use the home directory, unless it is +also unset in which case use "/", which is assumed to be a directory to which +all users have access. It is necessary to be in a visible directory for some +operating systems when running pipes, as some commands (e.g. "rm" under Solaris +2.5) require this. */ + +working_directory = (tp->current_dir != NULL)? + tp->current_dir : addr->current_dir; if (working_directory != NULL) {