diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2005-09-12 15:09:55 +0000 |
---|---|---|
committer | Philip Hazel <ph10@hermes.cam.ac.uk> | 2005-09-12 15:09:55 +0000 |
commit | fd6de02e0406522ba0cfff43d6be5b0201200b95 (patch) | |
tree | dffc936c8b855f9f9a3418d465013402498ca1b5 | |
parent | 95d1f782e772c5dd39d718409edabe1eca92690d (diff) |
Disable widen_domains when verifying senders, unless rewrite_headers is
off.
-rw-r--r-- | doc/doc-txt/ChangeLog | 5 | ||||
-rw-r--r-- | src/src/route.c | 6 | ||||
-rw-r--r-- | src/src/routers/accept.c | 4 | ||||
-rw-r--r-- | src/src/routers/accept.h | 4 | ||||
-rw-r--r-- | src/src/routers/dnslookup.c | 20 | ||||
-rw-r--r-- | src/src/routers/dnslookup.h | 4 | ||||
-rw-r--r-- | src/src/routers/ipliteral.c | 4 | ||||
-rw-r--r-- | src/src/routers/ipliteral.h | 4 | ||||
-rw-r--r-- | src/src/routers/iplookup.c | 4 | ||||
-rw-r--r-- | src/src/routers/iplookup.h | 4 | ||||
-rw-r--r-- | src/src/routers/manualroute.c | 8 | ||||
-rw-r--r-- | src/src/routers/manualroute.h | 4 | ||||
-rw-r--r-- | src/src/routers/queryprogram.c | 4 | ||||
-rw-r--r-- | src/src/routers/queryprogram.h | 4 | ||||
-rw-r--r-- | src/src/routers/redirect.c | 27 | ||||
-rw-r--r-- | src/src/routers/redirect.h | 4 | ||||
-rw-r--r-- | src/src/routers/rf_get_errors_address.c | 8 | ||||
-rw-r--r-- | src/src/structs.h | 4 |
18 files changed, 68 insertions, 54 deletions
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 5ad040e4c..55b7562c8 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.223 2005/09/12 14:03:42 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.224 2005/09/12 15:09:55 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -170,6 +170,9 @@ PH/41 Added a "distclean" target to the top-level Makefile; it deletes all PH/42 (But a TF fix): In a domain list, Exim incorrectly matched @[] if the IP address in a domain literal was a prefix of an interface address. +PH/43 (Again a TF fix): In the dnslookup router, do not apply widen_domains + when verifying a sender address, unless rewrite_headers is false. + Exim version 4.52 ----------------- diff --git a/src/src/route.c b/src/src/route.c index a80ecb62d..3a36f8a8e 100644 --- a/src/src/route.c +++ b/src/src/route.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/route.c,v 1.5 2005/03/15 11:37:21 ph10 Exp $ */ +/* $Cambridge: exim/src/src/route.c,v 1.6 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1697,8 +1697,8 @@ for (r = (addr->start_router == NULL)? routers : addr->start_router; HDEBUG(D_route) debug_printf("calling %s router\n", r->name); - yield = (r->info->code)(r, addr, pw, verify != v_none, paddr_local, - paddr_remote, addr_new, addr_succeed); + yield = (r->info->code)(r, addr, pw, verify, paddr_local, paddr_remote, + addr_new, addr_succeed); if (yield == FAIL) { diff --git a/src/src/routers/accept.c b/src/src/routers/accept.c index ae940661e..9b9c9d8cf 100644 --- a/src/src/routers/accept.c +++ b/src/src/routers/accept.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/accept.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/accept.c,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -81,7 +81,7 @@ int accept_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ diff --git a/src/src/routers/accept.h b/src/src/routers/accept.h index 421b8f923..2a7d33862 100644 --- a/src/src/routers/accept.h +++ b/src/src/routers/accept.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/accept.h,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/accept.h,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -25,7 +25,7 @@ extern accept_router_options_block accept_router_option_defaults; /* The main and initialization entry points for the router */ extern int accept_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void accept_router_init(router_instance *); diff --git a/src/src/routers/dnslookup.c b/src/src/routers/dnslookup.c index fd7140e46..50c767839 100644 --- a/src/src/routers/dnslookup.c +++ b/src/src/routers/dnslookup.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/dnslookup.c,v 1.4 2005/06/17 14:20:48 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/dnslookup.c,v 1.5 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -128,7 +128,7 @@ dnslookup_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ @@ -177,9 +177,19 @@ precedence over global names. For example, if the domain is "xxx.ch" it might be something in the "ch" toplevel domain, but it also might be xxx.ch.xyz.com. The choice of pre- or post-widening affects which takes precedence. If ever somebody comes up with some kind of requirement for pre-widening, presumably -with some conditions under which it is done, it can be selected here. */ - -if (ob->widen_domains != NULL) +with some conditions under which it is done, it can be selected here. + +The rewrite_headers option works only when routing an address at transport +time, because the alterations to the headers are not persistent so must be +worked out immediately before they are used. Sender addresses are routed for +verification purposes, but never at transport time, so any header changes that +you might expect as a result of sender domain widening do not occur. Therefore +we do not perform widening when verifying sender addresses; however, widening +sender addresses is OK if we do not have to rewrite the headers. The +suppression of widening for sender addresses is silent because it is the normal +desirable behaviour. */ + +if (ob->widen_domains != NULL && (verify != v_sender || !ob->rewrite_headers)) { listptr = ob->widen_domains; widen = string_nextinlist(&listptr, &widen_sep, widen_buffer, diff --git a/src/src/routers/dnslookup.h b/src/src/routers/dnslookup.h index 974fd47fe..57dd7e50a 100644 --- a/src/src/routers/dnslookup.h +++ b/src/src/routers/dnslookup.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/dnslookup.h,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/dnslookup.h,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -33,7 +33,7 @@ extern dnslookup_router_options_block dnslookup_router_option_defaults; /* The main and initialization entry points for the router */ extern int dnslookup_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void dnslookup_router_init(router_instance *); diff --git a/src/src/routers/ipliteral.c b/src/src/routers/ipliteral.c index b091c4e61..ac99fd989 100644 --- a/src/src/routers/ipliteral.c +++ b/src/src/routers/ipliteral.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/ipliteral.c,v 1.4 2005/01/11 15:51:03 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/ipliteral.c,v 1.5 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -90,7 +90,7 @@ ipliteral_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ diff --git a/src/src/routers/ipliteral.h b/src/src/routers/ipliteral.h index 9df8d087e..165f2bc49 100644 --- a/src/src/routers/ipliteral.h +++ b/src/src/routers/ipliteral.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/ipliteral.h,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/ipliteral.h,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -28,7 +28,7 @@ extern ipliteral_router_options_block ipliteral_router_option_defaults; /* The main and initialization entry points for the router */ extern int ipliteral_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void ipliteral_router_init(router_instance *); diff --git a/src/src/routers/iplookup.c b/src/src/routers/iplookup.c index f4120d91c..e7fba3447 100644 --- a/src/src/routers/iplookup.c +++ b/src/src/routers/iplookup.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/iplookup.c,v 1.3 2005/06/27 14:29:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/iplookup.c,v 1.4 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -137,7 +137,7 @@ iplookup_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ diff --git a/src/src/routers/iplookup.h b/src/src/routers/iplookup.h index 2de40389f..59b06b4d7 100644 --- a/src/src/routers/iplookup.h +++ b/src/src/routers/iplookup.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/iplookup.h,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/iplookup.h,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -35,7 +35,7 @@ extern iplookup_router_options_block iplookup_router_option_defaults; /* The main and initialization entry points for the router */ extern int iplookup_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void iplookup_router_init(router_instance *); diff --git a/src/src/routers/manualroute.c b/src/src/routers/manualroute.c index 128c09df8..e70c7bf3d 100644 --- a/src/src/routers/manualroute.c +++ b/src/src/routers/manualroute.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/manualroute.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/manualroute.c,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -191,7 +191,7 @@ manualroute_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ @@ -386,7 +386,7 @@ address is just accepted. */ if (hostlist[0] == 0) { - if (verify) goto ROUTED; + if (verify != v_none) goto ROUTED; addr->message = string_sprintf("error in %s router: no host(s) specified " "for domain %s", rblock->name, domain); log_write(0, LOG_MAIN, "%s", addr->message); @@ -405,7 +405,7 @@ if (rc != OK) return rc; defined for these hosts. It will be a remote one, as a local transport is dealt with above. However, we don't need one if verifying only. */ -if (transport == NULL && !verify) +if (transport == NULL && verify == v_none) { log_write(0, LOG_MAIN, "Error in %s router: no transport defined", rblock->name); diff --git a/src/src/routers/manualroute.h b/src/src/routers/manualroute.h index 64659b585..af2bf6202 100644 --- a/src/src/routers/manualroute.h +++ b/src/src/routers/manualroute.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/manualroute.h,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/manualroute.h,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -31,7 +31,7 @@ extern manualroute_router_options_block manualroute_router_option_defaults; /* The main and initialization entry points for the router */ extern int manualroute_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void manualroute_router_init(router_instance *); diff --git a/src/src/routers/queryprogram.c b/src/src/routers/queryprogram.c index 2aed3ef82..ee86553f8 100644 --- a/src/src/routers/queryprogram.c +++ b/src/src/routers/queryprogram.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.5 2005/06/27 14:29:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/queryprogram.c,v 1.6 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -181,7 +181,7 @@ queryprogram_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ diff --git a/src/src/routers/queryprogram.h b/src/src/routers/queryprogram.h index 57968817d..25f477180 100644 --- a/src/src/routers/queryprogram.h +++ b/src/src/routers/queryprogram.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/queryprogram.h,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/queryprogram.h,v 1.3 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -34,7 +34,7 @@ extern queryprogram_router_options_block queryprogram_router_option_defaults; /* The main and initialization entry points for the router */ extern int queryprogram_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void queryprogram_router_init(router_instance *); diff --git a/src/src/routers/redirect.c b/src/src/routers/redirect.c index 418116d03..9be15ede4 100644 --- a/src/src/routers/redirect.c +++ b/src/src/routers/redirect.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/redirect.c,v 1.13 2005/06/27 15:11:04 tom Exp $ */ +/* $Cambridge: exim/src/src/routers/redirect.c,v 1.14 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -258,7 +258,7 @@ passed on must have the original errors_address value. Arguments: rblock the router control block addr the address being routed - verify true if verifying + verify v_none/v_recipient/v_sender/v_expn addr_prop point to the propagated block, which is where the new values are to be placed @@ -268,7 +268,7 @@ Returns: the result of rf_get_errors_address() or rf_get_munge_headers(), static int sort_errors_and_headers(router_instance *rblock, address_item *addr, - BOOL verify, address_item_propagated *addr_prop) + int verify, address_item_propagated *addr_prop) { int frc = rf_get_errors_address(addr, rblock, verify, &(addr_prop->errors_address)); @@ -499,7 +499,7 @@ int redirect_router_entry( router_instance *rblock, /* data for this instantiation */ address_item *addr, /* address we are working on */ struct passwd *pw, /* passwd entry after check_local_user */ - BOOL verify, /* TRUE when verifying */ + int verify, /* v_none/v_recipient/v_sender/v_expn */ address_item **addr_local, /* add it to this if it's local */ address_item **addr_remote, /* add it to this if it's remote */ address_item **addr_new, /* put new addresses on here */ @@ -539,7 +539,7 @@ addr_prop.srs_sender = NULL; /* When verifying and testing addresses, the "logwrite" command in filters must be bypassed. */ -if (!verify && !address_test_mode) options |= RDO_REALLOG; +if (verify == v_none && !address_test_mode) options |= RDO_REALLOG; /* Sort out the fixed or dynamic uid/gid. This uid is used (a) for reading the file (and interpreting a filter) and (b) for running the transports for @@ -618,7 +618,8 @@ if (!ugid.gid_set && pw != NULL) /* Forward SRS */ /* No point in actually performing SRS if we are just verifying a recipient */ - if((srs_action & 1) && !verify && (sender_address ? sender_address[0] != 0 : FALSE)) + if((srs_action & 1) && verify == v_none && + (sender_address ? sender_address[0] != 0 : FALSE)) { srs_orig_sender = sender_address; @@ -801,12 +802,12 @@ dealing with it, the router declines. */ if (eblock != NULL) { if (!moan_skipped_syntax_errors( - rblock->name, /* For message content */ - eblock, /* Ditto */ - (verify || address_test_mode)? - NULL : ob->syntax_errors_to, /* Who to mail */ - generated != NULL, /* True if not all failed */ - ob->syntax_errors_text)) /* Custom message */ + rblock->name, /* For message content */ + eblock, /* Ditto */ + (verify != v_none || address_test_mode)? + NULL : ob->syntax_errors_to, /* Who to mail */ + generated != NULL, /* True if not all failed */ + ob->syntax_errors_text)) /* Custom message */ return DEFER; if (filtertype != FILTER_FORWARD || generated == NULL) @@ -835,7 +836,7 @@ generated anything. Log what happened to this address, and return DISCARD. */ if (frc == FF_DELIVERED) { - if (generated == NULL && !verify && !address_test_mode) + if (generated == NULL && verify == v_none && !address_test_mode) { log_write(0, LOG_MAIN, "=> %s <%s> R=%s", discarded, addr->address, rblock->name); diff --git a/src/src/routers/redirect.h b/src/src/routers/redirect.h index bc6ab974c..99241e40e 100644 --- a/src/src/routers/redirect.h +++ b/src/src/routers/redirect.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/redirect.h,v 1.5 2005/05/24 08:15:02 tom Exp $ */ +/* $Cambridge: exim/src/src/routers/redirect.h,v 1.6 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -69,7 +69,7 @@ extern redirect_router_options_block redirect_router_option_defaults; /* The main and initialization entry points for the router */ extern int redirect_router_entry(router_instance *, address_item *, - struct passwd *, BOOL, address_item **, address_item **, + struct passwd *, int, address_item **, address_item **, address_item **, address_item **); extern void redirect_router_init(router_instance *); diff --git a/src/src/routers/rf_get_errors_address.c b/src/src/routers/rf_get_errors_address.c index 08d18709a..e0eb0f026 100644 --- a/src/src/routers/rf_get_errors_address.c +++ b/src/src/routers/rf_get_errors_address.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/routers/rf_get_errors_address.c,v 1.3 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/routers/rf_get_errors_address.c,v 1.4 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -26,7 +26,7 @@ configuration. Arguments: addr the input address rblock the router instance - verify TRUE when verifying + verify v_none / v_recipient / v_sender / v_expn errors_to point the errors address here Returns: OK if no problem @@ -36,7 +36,7 @@ Returns: OK if no problem int rf_get_errors_address(address_item *addr, router_instance *rblock, - BOOL verify, uschar **errors_to) + int verify, uschar **errors_to) { uschar *s; @@ -75,7 +75,7 @@ of routers by checking the sender address. When testing an address, there may not be a sender address. We also need to save and restore the expansion values associated with an address. */ -if (verify) +if (verify != v_none) { *errors_to = s; DEBUG(D_route) diff --git a/src/src/structs.h b/src/src/structs.h index 824378871..f95c63ac0 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/structs.h,v 1.6 2005/05/24 08:15:02 tom Exp $ */ +/* $Cambridge: exim/src/src/structs.h,v 1.7 2005/09/12 15:09:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -307,7 +307,7 @@ typedef struct router_info { router_instance *, struct address_item *, struct passwd *, - BOOL, + int, struct address_item **, struct address_item **, struct address_item **, |