From: Philip Hazel Date: Wed, 29 Aug 2007 15:06:47 +0000 (+0000) Subject: Fix quoting problem with errors_copy. X-Git-Tag: exim-4_68~2 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bc64a74dadcd9d2560b84cad283a52e7346d4140;p=exim.git Fix quoting problem with errors_copy. --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 087c67205..9897e8f56 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -1,4 +1,4 @@ -$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.529 2007/08/29 14:02:22 ph10 Exp $ +$Cambridge: exim/doc/doc-txt/ChangeLog,v 1.530 2007/08/29 15:06:47 ph10 Exp $ Change log file for Exim from version 4.21 ------------------------------------------- @@ -101,6 +101,10 @@ PH/22 Guard against possible overflow in moan_check_errorcopy(). PH/23 POSIX allows open() to be a macro; guard against that. +PH/24 If the recipient of an error message contained an @ in the local part + (suitably quoted, of course), incorrect values were put in $domain and + $local_part during the evaluation of errors_copy. + Exim version 4.67 ----------------- diff --git a/src/src/moan.c b/src/src/moan.c index 0080e57be..1b6d1a97f 100644 --- a/src/src/moan.c +++ b/src/src/moan.c @@ -1,4 +1,4 @@ -/* $Cambridge: exim/src/src/moan.c,v 1.9 2007/08/29 13:58:57 ph10 Exp $ */ +/* $Cambridge: exim/src/src/moan.c,v 1.10 2007/08/29 15:06:47 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * @@ -584,7 +584,7 @@ if (errors_copy == NULL) return NULL; length of the local part. */ localpart = recipient; -domain = Ustrchr(recipient, '@'); +domain = Ustrrchr(recipient, '@'); if (domain == NULL) return NULL; /* should not occur, but avoid crash */ llen = domain++ - recipient; diff --git a/test/confs/0256 b/test/confs/0256 index 669fdb114..99faa1d76 100644 --- a/test/confs/0256 +++ b/test/confs/0256 @@ -11,8 +11,10 @@ gecos_name = CALLER_NAME # ----- Main settings ----- +acl_smtp_rcpt = accept qualify_domain = test.ex -errors_copy = *@* abcd@test.ex +errors_copy = *@* ${quote_local_part::abcd+$domain+$local_part}@test.ex +trusted_users = CALLER # ------ Routers ------ diff --git a/test/log/0256 b/test/log/0256 index aaab9b34d..c04aedc55 100644 --- a/test/log/0256 +++ b/test/log/0256 @@ -2,6 +2,13 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 ** unknown@test.ex: Unrouteable address 1999-03-02 09:44:33 10HmaY-0005vi-00 <= <> R=10HmaX-0005vi-00 U=EXIMUSER P=local S=sss 1999-03-02 09:44:33 10HmaY-0005vi-00 => CALLER R=r1 T=t1 -1999-03-02 09:44:33 10HmaY-0005vi-00 => abcd R=r1 T=t1 +1999-03-02 09:44:33 10HmaY-0005vi-00 => abcd+test.ex+CALLER R=r1 T=t1 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed +1999-03-02 09:44:33 10HmaZ-0005vi-00 <= "abc@def"@unknown.domain U=CALLER P=local-smtp S=sss +1999-03-02 09:44:33 10HmaZ-0005vi-00 ** unknown@test.ex: Unrouteable address +1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> R=10HmaZ-0005vi-00 U=EXIMUSER P=local S=sss +1999-03-02 09:44:33 10HmbA-0005vi-00 => abc@def <"abc@def"@unknown.domain> R=r1 T=t1 +1999-03-02 09:44:33 10HmbA-0005vi-00 => abcd+unknown.domain+"abc@def" <"abcd+unknown.domain+\"abc@def\""@test.ex> R=r1 T=t1 +1999-03-02 09:44:33 10HmbA-0005vi-00 Completed +1999-03-02 09:44:33 10HmaZ-0005vi-00 Completed diff --git a/test/mail/0256.abc@def b/test/mail/0256.abc@def new file mode 100644 index 000000000..22a2ecd35 --- /dev/null +++ b/test/mail/0256.abc@def @@ -0,0 +1,31 @@ +From MAILER-DAEMON Tue Mar 02 09:44:33 1999 +Received: from EXIMUSER by myhost.test.ex with local (Exim x.yz) + id 10HmbA-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 +X-Failed-Recipients: unknown@test.ex +Auto-Submitted: auto-replied +From: Mail Delivery System +To: "abc@def"@unknown.domain +Subject: Mail delivery failed: returning message to sender +Message-Id: +Date: Tue, 2 Mar 1999 09:44:33 +0000 + +This message was created automatically by mail delivery software. + +A message that you sent could not be delivered to one or more of its +recipients. This is a permanent error. The following address(es) failed: + + unknown@test.ex + Unrouteable address + +------ This is a copy of the message, including all the headers. ------ + +Return-path: <"abc@def"@unknown.domain> +Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz) + (envelope-from <"abc@def"@unknown.domain>) + id 10HmaZ-0005vi-00 + for unknown@test.ex; Tue, 2 Mar 1999 09:44:33 +0000 +Message-Id: +From: "abc@def"@unknown.domain +Date: Tue, 2 Mar 1999 09:44:33 +0000 + + diff --git a/test/mail/0256.abcd b/test/mail/0256.abcd+test.ex+ph10 similarity index 100% rename from test/mail/0256.abcd rename to test/mail/0256.abcd+test.ex+ph10 diff --git "a/test/mail/0256.abcd+unknown.domain+\"abc@def\"" "b/test/mail/0256.abcd+unknown.domain+\"abc@def\"" new file mode 100644 index 000000000..22a2ecd35 --- /dev/null +++ "b/test/mail/0256.abcd+unknown.domain+\"abc@def\"" @@ -0,0 +1,31 @@ +From MAILER-DAEMON Tue Mar 02 09:44:33 1999 +Received: from EXIMUSER by myhost.test.ex with local (Exim x.yz) + id 10HmbA-0005vi-00; Tue, 2 Mar 1999 09:44:33 +0000 +X-Failed-Recipients: unknown@test.ex +Auto-Submitted: auto-replied +From: Mail Delivery System +To: "abc@def"@unknown.domain +Subject: Mail delivery failed: returning message to sender +Message-Id: +Date: Tue, 2 Mar 1999 09:44:33 +0000 + +This message was created automatically by mail delivery software. + +A message that you sent could not be delivered to one or more of its +recipients. This is a permanent error. The following address(es) failed: + + unknown@test.ex + Unrouteable address + +------ This is a copy of the message, including all the headers. ------ + +Return-path: <"abc@def"@unknown.domain> +Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz) + (envelope-from <"abc@def"@unknown.domain>) + id 10HmaZ-0005vi-00 + for unknown@test.ex; Tue, 2 Mar 1999 09:44:33 +0000 +Message-Id: +From: "abc@def"@unknown.domain +Date: Tue, 2 Mar 1999 09:44:33 +0000 + + diff --git a/test/runtest b/test/runtest index 6a4fb2b51..77fe17a13 100755 --- a/test/runtest +++ b/test/runtest @@ -1,6 +1,6 @@ #! /usr/bin/perl -w -# $Cambridge: exim/test/runtest,v 1.28 2007/07/04 10:37:04 ph10 Exp $ +# $Cambridge: exim/test/runtest,v 1.29 2007/08/29 15:06:47 ph10 Exp $ ############################################################################### # This is the controlling script for the "new" test suite for Exim. It should # @@ -23,7 +23,7 @@ use Socket; # Start by initializing some global variables -$testversion = "4.68 (16-Apr-07)"; +$testversion = "4.68 (23-Aug-07)"; $cf = "bin/cf"; $cr = "\r"; @@ -909,7 +909,7 @@ if (! -e $sf) print "\n"; print "------------ $f -----------\n" if (defined $rf && -s $rf && defined $rsf && -s $rsf); - system("$more $f"); + system("$more '$f'"); } } @@ -1023,7 +1023,7 @@ if (-e $sf) # Do the comparison - return 0 if (system("$cf $mf $sf >test-cf") == 0); + return 0 if (system("$cf '$mf' '$sf' >test-cf") == 0); # Handle comparison failure @@ -1043,7 +1043,7 @@ if (-e $sf) # Update or delete the saved file, and give the appropriate return code. if (-s $mf) - { tests_exit(-1, "Failed to cp $mf $sf") if system("cp $mf $sf") != 0; } + { tests_exit(-1, "Failed to cp $mf $sf") if system("cp '$mf' '$sf'") != 0; } else { tests_exit(-1, "Failed to unlink $sf") if !unlink($sf); } diff --git a/test/scripts/0000-Basic/0256 b/test/scripts/0000-Basic/0256 index 0eefe7485..bdab73b33 100644 --- a/test/scripts/0000-Basic/0256 +++ b/test/scripts/0000-Basic/0256 @@ -2,3 +2,10 @@ exim -odi unknown . **** +exim -odi -bs +mail from:<"abc@def"@unknown.domain> +rcpt to: +data +. +quit +**** diff --git a/test/stdout/0256 b/test/stdout/0256 new file mode 100644 index 000000000..0058c5ec2 --- /dev/null +++ b/test/stdout/0256 @@ -0,0 +1,6 @@ +220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +250 OK +250 Accepted +354 Enter message, ending with "." on a line by itself +250 OK id=10HmaZ-0005vi-00 +221 myhost.test.ex closing connection