From: Wietse Venema Date: Mon, 23 Apr 2007 05:00:00 +0000 (-0500) Subject: postfix-2.5-20070423 X-Git-Tag: v2.5.0-RC1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=018a3aca1aaa22c72874fd6568e403692effc1ea;p=thirdparty%2Fpostfix.git postfix-2.5-20070423 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index e2494e371..4ce416abb 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -13460,6 +13460,12 @@ Apologies for any names omitted. is also responsible for "Delivered-To:" loop detection. File pipe/pipe.c. +20070423 + + The cache expiring transport map lookups did not distinguish + between wildcard transport map entry with an "empty" transport + field, or no wildcard transport map entry. + Wish list: Remove defer(8) and trace(8) references and man pages. These diff --git a/postfix/html/pipe.8.html b/postfix/html/pipe.8.html index cf1210a0c..ba1b42e7e 100644 --- a/postfix/html/pipe.8.html +++ b/postfix/html/pipe.8.html @@ -91,8 +91,8 @@ PIPE(8) PIPE(8) nation_recipient_limit must be 1 (see SIN- GLE-RECIPIENT DELIVERY above for details). - This code also enforces loop detection - (Postfix 2.5 and later). If a message + The D flag also enforces loop detection + (Postfix 2.5 and later): if a message already contains a Delivered-To: header with the same recipient address, then the message is returned as undeliverable. diff --git a/postfix/man/man8/pipe.8 b/postfix/man/man8/pipe.8 index 7b5a2c675..b18bf7329 100644 --- a/postfix/man/man8/pipe.8 +++ b/postfix/man/man8/pipe.8 @@ -89,8 +89,8 @@ envelope recipient address. Note: for this to work, the \fItransport\fB_destination_recipient_limit\fR must be 1 (see SINGLE-RECIPIENT DELIVERY above for details). .sp -This code also enforces loop detection (Postfix 2.5 and later). -If a message already contains a \fBDelivered-To:\fR header +The \fBD\fR flag also enforces loop detection (Postfix 2.5 and later): +if a message already contains a \fBDelivered-To:\fR header with the same recipient address, then the message is returned as undeliverable. .sp diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index b5f4ec0d8..84f5b3f4c 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20070422" +#define MAIL_RELEASE_DATE "20070423" #define MAIL_VERSION_NUMBER "2.5" #ifdef SNAPSHOT diff --git a/postfix/src/pipe/pipe.c b/postfix/src/pipe/pipe.c index ec163e15d..4ecf4e609 100644 --- a/postfix/src/pipe/pipe.c +++ b/postfix/src/pipe/pipe.c @@ -79,8 +79,8 @@ /* \fItransport\fB_destination_recipient_limit\fR must be 1 /* (see SINGLE-RECIPIENT DELIVERY above for details). /* .sp -/* This code also enforces loop detection (Postfix 2.5 and later). -/* If a message already contains a \fBDelivered-To:\fR header +/* The \fBD\fR flag also enforces loop detection (Postfix 2.5 and later): +/* if a message already contains a \fBDelivered-To:\fR header /* with the same recipient address, then the message is /* returned as undeliverable. /* .sp diff --git a/postfix/src/trivial-rewrite/transport.c b/postfix/src/trivial-rewrite/transport.c index 7750a372b..09fd2ec03 100644 --- a/postfix/src/trivial-rewrite/transport.c +++ b/postfix/src/trivial-rewrite/transport.c @@ -100,8 +100,7 @@ TRANSPORT_INFO *transport_pre_init(const char *transport_maps_name, tp->transport_path = maps_create(transport_maps_name, transport_maps, DICT_FLAG_LOCK | DICT_FLAG_FOLD_FIX | DICT_FLAG_NO_REGSUB); - tp->wildcard_channel = vstring_alloc(10); - tp->wildcard_nexthop = vstring_alloc(10); + tp->wildcard_channel = tp->wildcard_nexthop = 0; tp->transport_errno = 0; tp->expire = 0; return (tp); @@ -207,6 +206,18 @@ static int find_transport_entry(TRANSPORT_INFO *tp, const char *key, static void transport_wildcard_init(TRANSPORT_INFO *tp) { + VSTRING *channel = vstring_alloc(10); + VSTRING *nexthop = vstring_alloc(10); + + /* + * Both channel and nexthop may be zero-length strings. Therefore we must + * use something else to represent "wild-card does not exist". We use + * null VSTRING pointers, for historical reasons. + */ + if (tp->wildcard_channel) + vstring_free(tp->wildcard_channel); + if (tp->wildcard_nexthop) + vstring_free(tp->wildcard_nexthop); /* * Technically, the wildcard lookup pattern is redundant. A static map @@ -222,18 +233,19 @@ static void transport_wildcard_init(TRANSPORT_INFO *tp) #define FULL 0 #define PARTIAL DICT_FLAG_FIXED - if (find_transport_entry(tp, WILDCARD, "", FULL, - tp->wildcard_channel, - tp->wildcard_nexthop)) { + if (find_transport_entry(tp, WILDCARD, "", FULL, channel, nexthop)) { tp->transport_errno = 0; + tp->wildcard_channel = channel; + tp->wildcard_nexthop = nexthop; if (msg_verbose) msg_info("wildcard_{chan:hop}={%s:%s}", - vstring_str(tp->wildcard_channel), - vstring_str(tp->wildcard_nexthop)); + vstring_str(channel), vstring_str(nexthop)); } else { tp->transport_errno = dict_errno; - VSTRING_RESET(tp->wildcard_channel); - VSTRING_RESET(tp->wildcard_nexthop); + vstring_free(channel); + vstring_free(nexthop); + tp->wildcard_channel = 0; + tp->wildcard_nexthop = 0; } tp->expire = event_time() + 30; /* XXX make configurable */ } @@ -325,7 +337,7 @@ int transport_lookup(TRANSPORT_INFO *tp, const char *addr, if (tp->transport_errno) { dict_errno = tp->transport_errno; return (NOTFOUND); - } else if (tp->wildcard_channel && VSTRING_LEN(tp->wildcard_channel)) { + } else if (tp->wildcard_channel) { update_entry(STR(tp->wildcard_channel), STR(tp->wildcard_nexthop), rcpt_domain, channel, nexthop); return (FOUND);