filters by means of two new redirect router options.
-$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.115 2005/04/06 14:09:17 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.116 2005/04/06 14:40:23 ph10 Exp $
Change log file for Exim from version 4.21
-------------------------------------------
to make Exim compile on kfreebsd-gnu. (I'm totally confused about the
nomenclature these days.)
+PH/29 Installed patch from the Sieve maintainer that adds the options
+ sieve_useraddress and sieve_subaddress to the redirect router.
+
A note about Exim versions 4.44 and 4.50
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.34 2005/04/06 14:03:53 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.35 2005/04/06 14:40:23 ph10 Exp $
New Features in Exim
--------------------
Previously, $acl_verify_message was set only while expanding "message"
and "log_message" when a very denied access.
+PH/08 The redirect router has two new options, sieve_useraddress and
+ sieve_subaddress. These are passed to a Sieve filter to specify the :user
+ and :subaddress parts of an address. Both options are unset by default.
+ However, when a Sieve filter is run, if sieve_useraddress is unset, the
+ entire original local part (including any prefix or suffix) is used for
+ :user. An unset subaddress is treated as an empty subaddress.
Version 4.50
-/* $Cambridge: exim/src/src/deliver.c,v 1.10 2005/04/05 15:47:50 ph10 Exp $ */
+/* $Cambridge: exim/src/src/deliver.c,v 1.11 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
RDO_REWRITE,
NULL, /* No :include: restriction (not used in filter) */
NULL, /* No sieve vacation directory (not sieve!) */
+ NULL, /* No sieve user address (not sieve!) */
+ NULL, /* No sieve subaddress (not sieve!) */
&ugid, /* uid/gid data */
&addr_new, /* Where to hang generated addresses */
&filter_message, /* Where to put error message */
-/* $Cambridge: exim/src/src/filtertest.c,v 1.4 2005/02/17 11:58:26 ph10 Exp $ */
+/* $Cambridge: exim/src/src/filtertest.c,v 1.5 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
else
{
yield = (filter_type == FILTER_SIEVE)?
- sieve_interpret(filebuf, RDO_REWRITE, NULL, &generated, &error)
+ sieve_interpret(filebuf, RDO_REWRITE, NULL, NULL, NULL, &generated, &error)
:
filter_interpret(filebuf, RDO_REWRITE, &generated, &error);
}
-/* $Cambridge: exim/src/src/functions.h,v 1.13 2005/04/04 10:33:49 ph10 Exp $ */
+/* $Cambridge: exim/src/src/functions.h,v 1.14 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
#ifdef WITH_CONTENT_SCAN
extern int recv_line(int, uschar *, int);
#endif
-extern int rda_interpret(redirect_block *, int, uschar *, uschar *, ugid_block *,
- address_item **, uschar **, error_block **, int *, uschar *);
+extern int rda_interpret(redirect_block *, int, uschar *, uschar *,
+ uschar *, uschar *, ugid_block *, address_item **, uschar **,
+ error_block **, int *, uschar *);
extern int rda_is_filter(const uschar *);
extern BOOL readconf_depends(driver_instance *, uschar *);
extern void readconf_driver_init(uschar *, driver_instance **,
extern void sha1_end(sha1 *, const uschar *, int, uschar *);
extern void sha1_mid(sha1 *, const uschar *);
extern void sha1_start(sha1 *);
-extern int sieve_interpret(uschar *, int, uschar *, address_item **,
- uschar **);
+extern int sieve_interpret(uschar *, int, uschar *, uschar *, uschar *,
+ address_item **, uschar **);
extern void sigalrm_handler(int);
extern void smtp_closedown(uschar *);
extern int smtp_connect(host_item *, int, int, uschar *, int, BOOL);
-/* $Cambridge: exim/src/src/rda.c,v 1.4 2005/02/17 11:58:26 ph10 Exp $ */
+/* $Cambridge: exim/src/src/rda.c,v 1.5 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
options the options bits
include_directory restrain to this directory
sieve_vacation_directory passed to sieve_interpret
+ sieve_useraddress passed to sieve_interpret
+ sieve_subaddress passed to sieve_interpret
generated where to hang generated addresses
error for error messages
eblockp for details of skipped syntax errors
static int
rda_extract(redirect_block *rdata, int options, uschar *include_directory,
- uschar *sieve_vacation_directory, address_item **generated, uschar **error,
+ uschar *sieve_vacation_directory, uschar *sieve_useraddress,
+ uschar *sieve_subaddress, address_item **generated, uschar **error,
error_block **eblockp, int *filtertype)
{
uschar *data;
*error = US"Sieve filtering not enabled";
return FF_ERROR;
}
- frc = sieve_interpret(data, options, sieve_vacation_directory, generated,
- error);
+ frc = sieve_interpret(data, options, sieve_vacation_directory,
+ sieve_useraddress, sieve_subaddress, generated, error);
}
expand_forbid = old_expand_forbid;
plus ENOTDIR and EACCES handling bits
include_directory restrain :include: to this directory
sieve_vacation_directory directory passed to sieve_interpret()
+ sieve_useraddress passed to sieve_interpret
+ sieve_subaddress passed to sieve_interpret
ugid uid/gid to run under - if NULL, no change
generated where to hang generated addresses, initially NULL
error pointer for error message
int
rda_interpret(redirect_block *rdata, int options, uschar *include_directory,
- uschar *sieve_vacation_directory, ugid_block *ugid, address_item **generated,
+ uschar *sieve_vacation_directory, uschar *sieve_useraddress,
+ uschar *sieve_subaddress, ugid_block *ugid, address_item **generated,
uschar **error, error_block **eblockp, int *filtertype, uschar *rname)
{
int fd, rc, pfd[2];
Ustrstr(data, ":include:") == NULL)) /* and there's no :include: */
{
return rda_extract(rdata, options, include_directory,
- sieve_vacation_directory, generated, error, eblockp, filtertype);
+ sieve_vacation_directory, sieve_useraddress, sieve_subaddress,
+ generated, error, eblockp, filtertype);
}
/* We need to run the processing code in a sub-process. However, if we can
/* Now do the business */
yield = rda_extract(rdata, options, include_directory,
- sieve_vacation_directory, generated, error, eblockp, filtertype);
+ sieve_vacation_directory, sieve_useraddress, sieve_subaddress, generated,
+ error, eblockp, filtertype);
/* Pass back whether it was a filter, and the return code and any overall
error text via the pipe. */
-/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.3 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
RDO_REWRITE, /* rewrite generated addresses */
NULL, /* :include: directory not relevant */
NULL, /* sieve vacation directory not relevant */
+ NULL, /* sieve useraddress not relevant */
+ NULL, /* sieve subaddress not relevant */
&ugid, /* uid/gid (but not set) */
&generated, /* where to hang the results */
&(addr->message), /* where to put messages */
-/* $Cambridge: exim/src/src/routers/redirect.c,v 1.8 2005/03/22 15:02:34 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.c,v 1.9 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
(void *)offsetof(redirect_router_options_block, reply_transport_name) },
{ "rewrite", opt_bit | (RDON_REWRITE << 16),
(void *)offsetof(redirect_router_options_block, bit_options) },
+ { "sieve_subaddress", opt_stringptr,
+ (void *)offsetof(redirect_router_options_block, sieve_subaddress) },
+ { "sieve_useraddress", opt_stringptr,
+ (void *)offsetof(redirect_router_options_block, sieve_useraddress) },
{ "sieve_vacation_directory", opt_stringptr,
(void *)offsetof(redirect_router_options_block, sieve_vacation_directory) },
{ "skip_syntax_errors", opt_bool,
NULL, /* include_directory */
NULL, /* pipe_transport_name */
NULL, /* reply_transport_name */
+ NULL, /* sieve_subaddress */
+ NULL, /* sieve_useraddress */
NULL, /* sieve_vacation_directory */
NULL, /* syntax_errors_text */
NULL, /* syntax_errors_to */
}
frc = rda_interpret(&redirect, options, ob->include_directory,
- ob->sieve_vacation_directory, &ugid, &generated, &(addr->message),
- ob->skip_syntax_errors? &eblock : NULL, &filtertype,
- string_sprintf("%s router (recipient is %s)", rblock->name, addr->address));
+ ob->sieve_vacation_directory, ob->sieve_useraddress, ob->sieve_subaddress,
+ &ugid, &generated, &(addr->message), ob->skip_syntax_errors? &eblock : NULL,
+ &filtertype, string_sprintf("%s router (recipient is %s)", rblock->name,
+ addr->address));
qualify_domain_recipient = save_qualify_domain_recipient;
-/* $Cambridge: exim/src/src/routers/redirect.h,v 1.3 2005/01/04 10:00:44 ph10 Exp $ */
+/* $Cambridge: exim/src/src/routers/redirect.h,v 1.4 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
uschar *include_directory;
uschar *pipe_transport_name;
uschar *reply_transport_name;
+ uschar *sieve_subaddress;
+ uschar *sieve_useraddress;
uschar *sieve_vacation_directory;
uschar *syntax_errors_text;
uschar *syntax_errors_to;
-/* $Cambridge: exim/src/src/sieve.c,v 1.8 2005/03/01 10:21:44 ph10 Exp $ */
+/* $Cambridge: exim/src/src/sieve.c,v 1.9 2005/04/06 14:40:24 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) Michael Haardt 2003,2004 */
+/* Copyright (c) Michael Haardt 2003-2005 */
/* See the file NOTICE for conditions of use and distribution. */
/* This code was contributed by Michael Haardt. */
int vacation_ran;
#endif
uschar *vacation_directory;
+ const uschar *subaddress;
+ const uschar *useraddress;
int require_copy;
int require_iascii_numeric;
};
case ADDRPART_LOCALPART: part=extracted_addr; part[domain-1]='\0'; break;
case ADDRPART_DOMAIN: part=extracted_addr+domain; break;
#ifdef SUBADDRESS
- case ADDRPART_DETAIL:
- part=NULL;
+ case ADDRPART_DETAIL: part=NULL; break;
#endif
- break;
}
*end_addr = saveend;
case ADDRPART_LOCALPART: envelopeExpr=CUS "${local_part:$sender_address}"; break;
case ADDRPART_DOMAIN: envelopeExpr=CUS "${domain:$sender_address}"; break;
#ifdef SUBADDRESS
- case ADDRPART_DETAIL:
- envelopeExpr=CUS 0;
- break;
+ case ADDRPART_DETAIL: envelopeExpr=CUS 0; break;
#endif
}
}
{
case ADDRPART_ALL: envelopeExpr=CUS "$local_part_prefix$local_part$local_part_suffix@$domain"; break;
#ifdef SUBADDRESS
- case ADDRPART_USER: envelopeExpr=CUS "$local_part_prefix$local_part"; break;
- case ADDRPART_DETAIL: envelopeExpr=CUS "$local_part_suffix"; break;
+ case ADDRPART_USER: envelopeExpr=filter->useraddress; break;
+ case ADDRPART_DETAIL: envelopeExpr=filter->subaddress; break;
#endif
case ADDRPART_LOCALPART: envelopeExpr=CUS "$local_part_prefix$local_part$local_part_suffix"; break;
case ADDRPART_DOMAIN: envelopeExpr=CUS "$domain"; break;
options controls whether various special things are allowed, and requests
special actions (not currently used)
sieve_vacation_directory where to store vacation "once" files
+ useraddress string expression for :user part of address
+ subaddress string expression for :subaddress part of address
generated where to hang newly-generated addresses
error where to pass back an error text
int
sieve_interpret(uschar *filter, int options, uschar *vacation_directory,
- address_item **generated, uschar **error)
+ uschar *useraddress, uschar *subaddress, address_item **generated, uschar **error)
{
struct Sieve sieve;
int r;
}
}
+sieve.useraddress = useraddress == NULL ? CUS "$local_part_prefix$local_part$local_part_suffix" : useraddress;
+sieve.subaddress = subaddress;
+
#ifdef COMPILE_SYNTAX_CHECKER
if (parse_start(&sieve,0,generated)==1)
#else