From: Philip Hazel Date: Tue, 3 Oct 2006 10:25:55 +0000 (+0000) Subject: Fix misleading verification output when -v is used with -bv and aliasing X-Git-Tag: exim-4_64~72 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e6f6568e74c9aeb07d8cb02ecb1d997284eb885f;p=exim.git Fix misleading verification output when -v is used with -bv and aliasing leads to a mixture of successful and unsuccessful verification. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index b5e0aa221..111d2ae5c 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.401 2006/10/03 08:54:50 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.402 2006/10/03 10:25:55 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -82,6 +82,15 @@ PH/12 Installed Andrey Panin's patch to add a dovecot authenticator. Various PH/13 Added $message_headers_raw to provide the headers without RFC 2047 decoding. +PH/14 Corrected misleading output from -bv when -v was also used. Suppose the + address A is aliased to B and C, where B exists and C does not. Without + -v the output is "A verified" because verification stops after a + successful redirection if more than one address is generated. However, + with -v the child addresses are also verified. Exim was outputting "A + failed to verify" and then showing the successful verification for C, + with its parentage. It now outputs "B failed to verify", showing B's + parentage before showing the successful verification of C. + Exim version 4.63 ----------------- diff --git a/src/src/verify.c b/src/src/verify.c index 8881926b5..d180fdaa9 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/verify.c,v 1.39 2006/09/25 11:25:37 ph10 Exp $ */ +/* $Cambridge: exim/src/src/verify.c,v 1.40 2006/10/03 10:25:55 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -1009,11 +1009,17 @@ information about the top level address, not anything that it generated. */ while (addr_new != NULL) { int rc; + uschar *show_address; address_item *addr = addr_new; addr_new = addr->next; addr->next = NULL; + /* When full_info is set, child addresses are displayed in top-level + messages. Otherwise, we show only the top level address. */ + + show_address = full_info? addr->address : address; + DEBUG(D_verify) { debug_printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); @@ -1207,14 +1213,24 @@ while (addr_new != NULL) allok = FALSE; if (f != NULL) { - fprintf(f, "%s%s %s", ko_prefix, address, + address_item *p = addr->parent; + + fprintf(f, "%s%s %s", ko_prefix, show_address, address_test_mode? "is undeliverable" : "failed to verify"); if (!expn && admin_user) { if (addr->basic_errno > 0) fprintf(f, ": %s", strerror(addr->basic_errno)); if (addr->message != NULL) - fprintf(f, ":\n %s", addr->message); + fprintf(f, ": %s", addr->message); + } + + /* Show parents iff doing full info */ + + if (full_info) while (p != NULL) + { + fprintf(f, "%s\n <-- %s", cr, p->address); + p = p->parent; } fprintf(f, "%s\n", cr); } @@ -1230,25 +1246,35 @@ while (addr_new != NULL) allok = FALSE; if (f != NULL) { - fprintf(f, "%s%s cannot be resolved at this time", ko_prefix, address); + address_item *p = addr->parent; + fprintf(f, "%s%s cannot be resolved at this time", ko_prefix, + show_address); if (!expn && admin_user) { if (addr->basic_errno > 0) - fprintf(f, ":\n %s", strerror(addr->basic_errno)); + fprintf(f, ": %s", strerror(addr->basic_errno)); if (addr->message != NULL) - fprintf(f, ":\n %s", addr->message); + fprintf(f, ": %s", addr->message); else if (addr->basic_errno <= 0) - fprintf(f, ":\n unknown error"); + fprintf(f, ": unknown error"); } + /* Show parents iff doing full info */ + + if (full_info) while (p != NULL) + { + fprintf(f, "%s\n <-- %s", cr, p->address); + p = p->parent; + } fprintf(f, "%s\n", cr); } + if (!full_info) return copy_error(vaddr, addr, DEFER); else if (yield == OK) yield = DEFER; } /* If we are handling EXPN, we do not want to continue to route beyond - the top level. */ + the top level (whose address is in "address"). */ else if (expn) { @@ -1295,7 +1321,7 @@ while (addr_new != NULL) (addr_new != NULL && /* At least one new address AND */ success_on_redirect))) /* success_on_redirect is set */ { - if (f != NULL) fprintf(f, "%s %s\n", address, + if (f != NULL) fprintf(f, "%s %s\n", show_address, address_test_mode? "is deliverable" : "verified"); /* If we have carried on to verify a child address, we want the value diff --git a/test/aux-fixed/0212.aliases b/test/aux-fixed/0212.aliases index 064b67d58..c6c26ccfc 100644 --- a/test/aux-fixed/0212.aliases +++ b/test/aux-fixed/0212.aliases @@ -6,3 +6,5 @@ f1: :fail: bad user p: userx pipe: |/bin/nosuchfile file: /tmp/junk +v1: a3, userx +v2: userx, a3 diff --git a/test/scripts/0000-Basic/0212 b/test/scripts/0000-Basic/0212 index 534f0d94c..29a8d25aa 100644 --- a/test/scripts/0000-Basic/0212 +++ b/test/scripts/0000-Basic/0212 @@ -40,3 +40,10 @@ vrfy <"smartuser.b@test.ex"@test.ex> vrfy <"smartuser.b@test.ex,a@test.ex"@test.ex> quit **** +# Check fail/non-fail without and with -v +0 +exim -bv v1 v2 +**** +2 +exim -v -bv v1 v2 +**** diff --git a/test/stdout/0212 b/test/stdout/0212 index 382af7bbe..9f1626ae4 100644 --- a/test/stdout/0212 +++ b/test/stdout/0212 @@ -1,17 +1,13 @@ > a@test.ex verified -> b@test.ex failed to verify: - Unrouteable address -> f@test.ex failed to verify: - bad user +> b@test.ex failed to verify: Unrouteable address +> f@test.ex failed to verify: bad user > p@test.ex verified -> x@test.ex failed to verify: - Unrouteable address +> x@test.ex failed to verify: Unrouteable address > y@test.ex verified > pipe@test.ex verified > file@test.ex verified > "smartuser.a@test.ex"@test.ex verified -> "smartuser.b@test.ex"@test.ex failed to verify: - Unrouteable address +> "smartuser.b@test.ex"@test.ex failed to verify: Unrouteable address > "smartuser.b@test.ex,a@test.ex"@test.ex verified > 220 the.local.host.name ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 @@ -40,3 +36,15 @@ 550 <"smartuser.b@test.ex"@test.ex> Unrouteable address 250 <"smartuser.b@test.ex,a@test.ex"@test.ex> is deliverable 221 the.local.host.name closing connection +v1@test.ex verified +v2@test.ex verified +a3@test.ex failed to verify: bad user + <-- v1@test.ex +userx@test.ex + <-- v1@test.ex + router = all, transport = local_delivery +a3@test.ex failed to verify: bad user + <-- v2@test.ex +userx@test.ex [duplicate, would not be delivered] + <-- v2@test.ex + router = all, transport = local_delivery