[exim-cvs] Testsuite: add testcase for <>-mismatch in To:/Fr…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Exim Git Commits Mailing List
Date:  
À: exim-cvs
Sujet: [exim-cvs] Testsuite: add testcase for <>-mismatch in To:/From: headers
Gitweb: http://git.exim.org/exim.git/commitdiff/cf02e6b2e7178276ea5b4b99448f73a1cdfe0c9e
Commit:     cf02e6b2e7178276ea5b4b99448f73a1cdfe0c9e
Parent:     5032d1cf500b102849d9a47867fbb7b34d871683
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Jan 20 20:57:15 2015 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Jan 20 21:03:34 2015 +0000


    Testsuite: add testcase for <>-mismatch in To:/From: headers
---
 test/confs/0026              |    1 +
 test/log/0026                |   31 +++++++++++++++++++++----------
 test/mail/0026.userx         |   12 ++++++------
 test/rejectlog/0026          |   34 +++++++++++++++++++++++-----------
 test/scripts/0000-Basic/0026 |   13 +++++++++++++
 test/stderr/0026             |    9 +++++++--
 test/stdout/0026             |   16 +++++++++++-----
 7 files changed, 82 insertions(+), 34 deletions(-)


diff --git a/test/confs/0026 b/test/confs/0026
index db267d5..d9c939d 100644
--- a/test/confs/0026
+++ b/test/confs/0026
@@ -24,6 +24,7 @@ begin acl
 acl_data:
   deny     log_message = body contains trigger
            condition = ${if match{$message_body}{trigger}{yes}{no}}
+  warn       logwrite = \$h_from: '$h_from:'
   require  verify = header_syntax
   warn     message = X-warning: this is a test warning
   accept   senders = ! :
diff --git a/test/log/0026 b/test/log/0026
index cf99584..e397636 100644
--- a/test/log/0026
+++ b/test/log/0026
@@ -1,16 +1,27 @@
-1999-03-02 09:44:33 10HmbC-0005vi-00 <= x@y U=CALLER P=local-smtp S=sss
+1999-03-02 09:44:33 10HmbD-0005vi-00 $h_from: 'x@y'
+1999-03-02 09:44:33 10HmbD-0005vi-00 <= x@y U=CALLER P=local-smtp S=sss
+1999-03-02 09:44:33 10HmaX-0005vi-00 $h_from: '@'
 1999-03-02 09:44:33 10HmaX-0005vi-00 U=CALLER F=<x@y> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
-1999-03-02 09:44:33 10HmaY-0005vi-00 U=CALLER F=<> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
-1999-03-02 09:44:33 10HmaZ-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
-1999-03-02 09:44:33 10HmbD-0005vi-00 <= <> U=CALLER P=local-smtp S=sss
-1999-03-02 09:44:33 10HmbA-0005vi-00 U=CALLER F=<x@y> rejected after DATA: body contains trigger
-1999-03-02 09:44:33 10HmbE-0005vi-00 <= x@y U=CALLER P=local-smtp S=sss
-1999-03-02 09:44:33 10HmbE-0005vi-00 => userx <userx@???> R=r2 T=local_delivery
-1999-03-02 09:44:33 10HmbE-0005vi-00 Completed
+1999-03-02 09:44:33 10HmaY-0005vi-00 $h_from: '<forged@???'
+1999-03-02 09:44:33 10HmaY-0005vi-00 U=CALLER F=<x@y> rejected after DATA: '>' missing at end of address: failing address in "To:" header is: <dummy@???
+1999-03-02 09:44:33 10HmaZ-0005vi-00 $h_from: '<x@y>, @'
+1999-03-02 09:44:33 10HmaZ-0005vi-00 U=CALLER F=<> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
+1999-03-02 09:44:33 10HmbA-0005vi-00 $h_from: '<x@y>'
+1999-03-02 09:44:33 10HmbA-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmbE-0005vi-00 $h_from: '<postmaster@???>'
+1999-03-02 09:44:33 10HmbE-0005vi-00 <= <> U=CALLER P=local-smtp S=sss
+1999-03-02 09:44:33 10HmbB-0005vi-00 U=CALLER F=<x@y> rejected after DATA: body contains trigger
+1999-03-02 09:44:33 10HmbF-0005vi-00 $h_from: 'x@y'
 1999-03-02 09:44:33 10HmbF-0005vi-00 <= x@y U=CALLER P=local-smtp S=sss
 1999-03-02 09:44:33 10HmbF-0005vi-00 => userx <userx@???> R=r2 T=local_delivery
 1999-03-02 09:44:33 10HmbF-0005vi-00 Completed
-1999-03-02 09:44:33 10HmbG-0005vi-00 <= <> U=CALLER P=local-smtp S=sss
+1999-03-02 09:44:33 10HmbG-0005vi-00 $h_from: 'x@y'
+1999-03-02 09:44:33 10HmbG-0005vi-00 <= x@y U=CALLER P=local-smtp S=sss
 1999-03-02 09:44:33 10HmbG-0005vi-00 => userx <userx@???> R=r2 T=local_delivery
 1999-03-02 09:44:33 10HmbG-0005vi-00 Completed
-1999-03-02 09:44:33 10HmbB-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmbH-0005vi-00 $h_from: 'userx@???'
+1999-03-02 09:44:33 10HmbH-0005vi-00 <= <> U=CALLER P=local-smtp S=sss
+1999-03-02 09:44:33 10HmbH-0005vi-00 => userx <userx@???> R=r2 T=local_delivery
+1999-03-02 09:44:33 10HmbH-0005vi-00 Completed
+1999-03-02 09:44:33 10HmbC-0005vi-00 $h_from: ''
+1999-03-02 09:44:33 10HmbC-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
diff --git a/test/mail/0026.userx b/test/mail/0026.userx
index 4c78221..67c1c08 100644
--- a/test/mail/0026.userx
+++ b/test/mail/0026.userx
@@ -1,9 +1,9 @@
 From x@y Tue Mar 02 09:44:33 1999
 Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
     (envelope-from <x@y>)
-    id 10HmbE-0005vi-00
+    id 10HmbF-0005vi-00
     for userx@???; Tue, 2 Mar 1999 09:44:33 +0000
-Message-Id: <E10HmbE-0005vi-00@???>
+Message-Id: <E10HmbF-0005vi-00@???>
 From: x@y
 Date: Tue, 2 Mar 1999 09:44:33 +0000
 X-warning: this is a test warning
@@ -13,11 +13,11 @@ Message 7
 From x@y Tue Mar 02 09:44:33 1999
 Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
     (envelope-from <x@y>)
-    id 10HmbF-0005vi-00
+    id 10HmbG-0005vi-00
     for userx@???; Tue, 2 Mar 1999 09:44:33 +0000
 to: group name: x@y, p@q;
 reply-to: group name: a@b, c@d;
-Message-Id: <E10HmbF-0005vi-00@???>
+Message-Id: <E10HmbG-0005vi-00@???>
 From: x@y
 Date: Tue, 2 Mar 1999 09:44:33 +0000
 X-warning: this is a test warning
@@ -26,12 +26,12 @@ Message 10


 From MAILER-DAEMON Tue Mar 02 09:44:33 1999
 Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
-    id 10HmbG-0005vi-00
+    id 10HmbH-0005vi-00
     for userx@???; Tue, 2 Mar 1999 09:44:33 +0000
 to: group name: x@y, p@q;
 reply-to: group name:;
 from: userx@???
-Message-Id: <E10HmbG-0005vi-00@???>
+Message-Id: <E10HmbH-0005vi-00@???>
 Date: Tue, 2 Mar 1999 09:44:33 +0000
 X-warning: this is a test warning


diff --git a/test/rejectlog/0026 b/test/rejectlog/0026
index 716e35c..3a6ff66 100644
--- a/test/rejectlog/0026
+++ b/test/rejectlog/0026
@@ -8,43 +8,55 @@ P Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
 F From: @
 I Message-Id: <E10HmaX-0005vi-00@???>
   Date: Tue, 2 Mar 1999 09:44:33 +0000
-1999-03-02 09:44:33 10HmaY-0005vi-00 U=CALLER F=<> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
-Envelope-from: <>
+1999-03-02 09:44:33 10HmaY-0005vi-00 U=CALLER F=<x@y> rejected after DATA: '>' missing at end of address: failing address in "To:" header is: <dummy@???
+Envelope-from: <x@y>
 Envelope-to: <x@y>
 P Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
+    (envelope-from <x@y>)
     id 10HmaY-0005vi-00
     for x@y; Tue, 2 Mar 1999 09:44:33 +0000
-F From: <x@y>, @
+T To: <dummy@???
+  Subject: incomprehensible
+F From: <forged@???
 I Message-Id: <E10HmaY-0005vi-00@???>
   Date: Tue, 2 Mar 1999 09:44:33 +0000
-1999-03-02 09:44:33 10HmaZ-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmaZ-0005vi-00 U=CALLER F=<> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
 Envelope-from: <>
 Envelope-to: <x@y>
 P Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
     id 10HmaZ-0005vi-00
     for x@y; Tue, 2 Mar 1999 09:44:33 +0000
-F From: <x@y>
+F From: <x@y>, @
 I Message-Id: <E10HmaZ-0005vi-00@???>
   Date: Tue, 2 Mar 1999 09:44:33 +0000
+1999-03-02 09:44:33 10HmbA-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
+Envelope-from: <>
+Envelope-to: <x@y>
+P Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
+    id 10HmbA-0005vi-00
+    for x@y; Tue, 2 Mar 1999 09:44:33 +0000
+F From: <x@y>
+I Message-Id: <E10HmbA-0005vi-00@???>
+  Date: Tue, 2 Mar 1999 09:44:33 +0000
   X-warning: this is a test warning
-1999-03-02 09:44:33 10HmbA-0005vi-00 U=CALLER F=<x@y> rejected after DATA: body contains trigger
+1999-03-02 09:44:33 10HmbB-0005vi-00 U=CALLER F=<x@y> rejected after DATA: body contains trigger
 Envelope-from: <x@y>
 Envelope-to: <x@y>
 P Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
     (envelope-from <x@y>)
-    id 10HmbA-0005vi-00
+    id 10HmbB-0005vi-00
     for x@y; Tue, 2 Mar 1999 09:44:33 +0000
-I Message-Id: <E10HmbA-0005vi-00@???>
+I Message-Id: <E10HmbB-0005vi-00@???>
 F From: x@y
   Date: Tue, 2 Mar 1999 09:44:33 +0000
-1999-03-02 09:44:33 10HmbB-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
+1999-03-02 09:44:33 10HmbC-0005vi-00 U=CALLER F=<> rejected after DATA: there is no valid sender in any header line
 Envelope-from: <>
 Envelope-to: <userx@???>
 P Received: from CALLER by myhost.test.ex with local-smtp (Exim x.yz)
-    id 10HmbB-0005vi-00
+    id 10HmbC-0005vi-00
     for userx@???; Tue, 2 Mar 1999 09:44:33 +0000
 T to: group name: x@y, p@q;
 R reply-to: group name:;
-I Message-Id: <E10HmbB-0005vi-00@???>
+I Message-Id: <E10HmbC-0005vi-00@???>
   Date: Tue, 2 Mar 1999 09:44:33 +0000
   X-warning: this is a test warning
diff --git a/test/scripts/0000-Basic/0026 b/test/scripts/0000-Basic/0026
index 7489cbd..9d30d2d 100644
--- a/test/scripts/0000-Basic/0026
+++ b/test/scripts/0000-Basic/0026
@@ -20,6 +20,19 @@ Message 2
 .
 quit
 ****
+# Syntax error (version 2) in header => should fail
+exim -odq -bs
+mail from:<x@y>
+rcpt to:<x@y>
+data
+To: <dummy@???
+Subject: incomprehensible
+From: <forged@???
+
+Message 2a
+.
+quit
+****
 # Syntax error in header => should fail even with null sender
 exim -odq -bs
 mail from:<>
diff --git a/test/stderr/0026 b/test/stderr/0026
index 26c2736..5e99669 100644
--- a/test/stderr/0026
+++ b/test/stderr/0026
@@ -16,11 +16,16 @@

 >>> check condition = ${if match{$message_body}{trigger}{yes}{no}}
 >>>                 = no
 >>> deny: condition test failed in ACL "acl_data"

+>>> processing "warn"
+>>> check logwrite = \$h_from: '$h_from:'
+>>>                = $h_from: '@'
+LOG: 10HmbI-0005vi-00 $h_from: '@'
+>>> warn: condition test succeeded in ACL "acl_data"

>>> processing "require"
>>> check verify = header_syntax
>>> require: condition test failed in ACL "acl_data"
>>> end of ACL "acl_data": not OK

-LOG: 10HmbH-0005vi-00 H=[10.0.0.0] F=<x@y> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
+LOG: 10HmbI-0005vi-00 H=[10.0.0.0] F=<x@y> rejected after DATA: domain missing or malformed: failing address in "From:" header is: @
>>> host in hosts_connection_nolog? no (option unset)
>>> host in host_lookup? no (option unset)
>>> host in host_reject_connection? no (option unset)

@@ -40,4 +45,4 @@ LOG: 10HmbH-0005vi-00 H=[10.0.0.0] F=<x@y> rejected after DATA: domain missing o
 >>>                 = yes
 >>> deny: condition test succeeded in ACL "acl_data"
 >>> end of ACL "acl_data": DENY

-LOG: 10HmbI-0005vi-00 H=[10.0.0.0] F=<x@y> rejected after DATA: body contains trigger
+LOG: 10HmbJ-0005vi-00 H=[10.0.0.0] F=<x@y> rejected after DATA: body contains trigger
diff --git a/test/stdout/0026 b/test/stdout/0026
index f95e2ff..1fac537 100644
--- a/test/stdout/0026
+++ b/test/stdout/0026
@@ -2,7 +2,7 @@
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
-250 OK id=10HmbC-0005vi-00
+250 OK id=10HmbD-0005vi-00
221 myhost.test.ex closing connection
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
250 OK
@@ -26,7 +26,13 @@
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
-250 OK id=10HmbD-0005vi-00
+550 Administrative prohibition
+221 myhost.test.ex closing connection
+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=10HmbE-0005vi-00
221 myhost.test.ex closing connection
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
250 OK
@@ -38,7 +44,7 @@
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
-250 OK id=10HmbE-0005vi-00
+250 OK id=10HmbF-0005vi-00
221 myhost.test.ex closing connection

**** SMTP testing session as if from host 10.0.0.0
@@ -66,13 +72,13 @@
250 OK
250 Accepted
354 Enter message, ending with "." on a line by itself
-250 OK id=10HmbF-0005vi-00
+250 OK id=10HmbG-0005vi-00
221 myhost.test.ex closing connection
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=10HmbG-0005vi-00
+250 OK id=10HmbH-0005vi-00
221 myhost.test.ex closing connection
220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
250 OK