Wednesday 10 May 2006 17:36 skrev Philip Hazel:
> On Wed, 10 May 2006, Magnus Holmgren wrote:
> > As I said in the OP, I can't set file = $home/.forward then. I could set
> > it to /home/$local_part/.forward, but it's not Right since $home is
> > looked up and could theoretically be anything. Also, $home can
> > potentially be useful in the filter file.
>
> WishListed.
Thanks. Patch attached (dpatch ready). Hope it's acceptable. Name of option
can be discussed.
--
Magnus Holmgren
holmgren@???
#! /bin/sh /usr/share/dpatch/dpatch-run
## 80_filter_prepend_home.dpatch by <magnus@???>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
diff -urNad exim4-4.61~/src/filter.c exim4-4.61/src/filter.c
--- exim4-4.61~/src/filter.c 2006-05-10 22:54:47.000000000 +0200
+++ exim4-4.61/src/filter.c 2006-05-10 23:04:34.000000000 +0200
@@ -1837,7 +1837,8 @@
DEBUG(D_filter) debug_printf("Filter: %ssave message to: %s%s\n",
(commands->seen)? "" : "unseen ", s,
commands->noerror? " (noerror)" : "");
- if (s[0] != '/' && deliver_home != NULL && deliver_home[0] != 0)
+ if (s[0] != '/' && ((filter_options & RDO_PREPEND_HOME) != 0)
+ && deliver_home != NULL && deliver_home[0] != 0)
s = string_sprintf("%s/%s", deliver_home, s);
/* Create the new address and add it to the chain, setting the
diff -urNad exim4-4.61~/src/macros.h exim4-4.61/src/macros.h
--- exim4-4.61~/src/macros.h 2006-05-10 22:54:47.000000000 +0200
+++ exim4-4.61/src/macros.h 2006-05-10 23:02:15.000000000 +0200
@@ -508,6 +508,7 @@
#define RDO_REWRITE 0x00020000 /* Rewrite generated addresses */
#define RDO_EXIM_FILTER 0x00040000 /* Forbid Exim filters */
#define RDO_SIEVE_FILTER 0x00080000 /* Forbid Sieve filters */
+#define RDO_PREPEND_HOME 0x00100000 /* Prepend $home to relative paths in Exim filter save commands */
/* This is the set that apply to expansions in filters */
@@ -521,7 +522,7 @@
enum { RDON_BLACKHOLE, RDON_DEFER, RDON_EACCES, RDON_ENOTDIR, RDON_EXISTS,
RDON_FAIL, RDON_FILTER, RDON_FREEZE, RDON_INCLUDE, RDON_LOG, RDON_LOOKUP,
RDON_PERL, RDON_READFILE, RDON_READSOCK, RDON_RUN, RDON_DLFUNC, RDON_REALLOG,
- RDON_REWRITE, RDON_EXIM_FILTER, RDON_SIEVE_FILTER };
+ RDON_REWRITE, RDON_EXIM_FILTER, RDON_SIEVE_FILTER, RDON_PREPEND_HOME };
/* Results of filter or forward file processing. Some are only from a filter;
some are only from a forward file. */
diff -urNad exim4-4.61~/src/routers/redirect.c exim4-4.61/src/routers/redirect.c
--- exim4-4.61~/src/routers/redirect.c 2006-05-10 22:54:47.000000000 +0200
+++ exim4-4.61/src/routers/redirect.c 2006-05-10 23:03:56.000000000 +0200
@@ -39,6 +39,8 @@
(void *)offsetof(redirect_router_options_block, file) },
{ "file_transport", opt_stringptr,
(void *)offsetof(redirect_router_options_block, file_transport_name) },
+ { "filter_prepend_home",opt_bit | (RDON_PREPEND_HOME << 16),
+ (void *)offsetof(redirect_router_options_block, bit_options) },
{ "forbid_blackhole", opt_bit | (RDON_BLACKHOLE << 16),
(void *)offsetof(redirect_router_options_block, bit_options) },
{ "forbid_exim_filter", opt_bit | (RDON_EXIM_FILTER << 16),
@@ -160,7 +162,7 @@
NULL, /* srs_dbselect */
#endif
022, /* modemask */
- RDO_REWRITE, /* bit_options */
+ RDO_REWRITE | RDO_PREPEND_HOME, /* bit_options */
FALSE, /* check_ancestor */
TRUE_UNSET, /* check_owner */
TRUE_UNSET, /* check_group */