summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2023-07-15 20:24:01 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2023-07-15 22:12:03 +0100
commit87a97abbfb57cb6583c330e09446c3e8549fd32f (patch)
treefea66a9818b4f5f46061b865280d87243b50f074 /test
parent280ea2d7ca4b9b1a3f5d34a243f48e652114a5f4 (diff)
Testsuite: basic Sieve operations
Diffstat (limited to 'test')
-rw-r--r--test/aux-fixed/0950.sieve12
-rw-r--r--test/confs/095058
-rw-r--r--test/log/04922
-rw-r--r--test/log/095017
-rw-r--r--test/log/54002
-rw-r--r--test/mail/0950.CALLER15
-rw-r--r--test/mail/0950.myfolder14
-rwxr-xr-xtest/runtest4
-rw-r--r--test/scripts/0000-Basic/095067
-rw-r--r--test/stdout/095080
10 files changed, 267 insertions, 4 deletions
diff --git a/test/aux-fixed/0950.sieve b/test/aux-fixed/0950.sieve
new file mode 100644
index 000000000..2f7b08d74
--- /dev/null
+++ b/test/aux-fixed/0950.sieve
@@ -0,0 +1,12 @@
+# Sieve filter
+#
+
+require "fileinto";
+
+if header :contains "from" "coyote" {
+ discard;
+} elsif header :contains "from" "spot_this" {
+ fileinto "myfolder";
+} elsif header :contains "from" "redirect" {
+ redirect "fred@some_other_dom.ain";
+}
diff --git a/test/confs/0950 b/test/confs/0950
new file mode 100644
index 000000000..f75e2c4d4
--- /dev/null
+++ b/test/confs/0950
@@ -0,0 +1,58 @@
+# Exim test configuration 0950
+
+SERVER=
+
+.include DIR/aux-var/std_conf_prefix
+
+primary_hostname = myhost.test.ex
+log_selector = +received_recipients +smtp_connection +millisec
+
+
+# ----- Main settings -----
+
+acl_smtp_rcpt = accept
+
+# ----- Routers -----
+
+begin routers
+
+discard:
+ driver = redirect
+ domains = !test.ex
+ data = :blackhole:
+
+client:
+ driver = redirect
+ file = DIR/aux-fixed/TESTNUM.sieve
+ allow_filter
+ user = CALLER
+ file_transport = local_file
+ errors_to = ""
+
+# ----- Transports -----
+
+begin transports
+
+local_file:
+ driver = appendfile
+ file = DIR/test-mail/${if eq{$address_file}{inbox} {$local_part} {$address_file}}
+ create_file = DIR/test-mail
+ delivery_date_add
+ envelope_to_add
+ return_path_add
+
+send_to_server:
+ driver = smtp
+ allow_localhost
+ hosts = 127.0.0.1
+ port = PORT_D
+
+# ----- Retry -----
+
+
+begin retry
+
+* * F,5d,10s
+
+
+# End
diff --git a/test/log/0492 b/test/log/0492
index 7bd198a46..cce2547ae 100644
--- a/test/log/0492
+++ b/test/log/0492
@@ -4,8 +4,8 @@
1999-03-02 09:44:33 10HmaX-000000005vi-0000 *> b@test.ex P=<b@aa> R=r1 T=t1 H=127.0.0.1 [127.0.0.1] C="delivery bypassed by -N option"
1999-03-02 09:44:33 10HmaX-000000005vi-0000 Completed
1999-03-02 09:44:33 10HmaY-000000005vi-0000 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
-1999-03-02 09:44:33 10HmaY-000000005vi-0000 *> b@test.ex P=<b@aa> R=r1 T=t1 H=127.0.0.1 [127.0.0.1] C="delivery bypassed by -N option"
1999-03-02 09:44:33 10HmaY-000000005vi-0000 *> a@test.ex P=<a@aa> R=r1 T=t1 H=127.0.0.1 [127.0.0.1] C="delivery bypassed by -N option"
+1999-03-02 09:44:33 10HmaY-000000005vi-0000 *> b@test.ex P=<b@aa> R=r1 T=t1 H=127.0.0.1 [127.0.0.1] C="delivery bypassed by -N option"
1999-03-02 09:44:33 10HmaY-000000005vi-0000 Completed
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
1999-03-02 09:44:33 10HmaZ-000000005vi-0000 => /dev/null <blackhole@test.ex> R=bh T=**bypassed**
diff --git a/test/log/0950 b/test/log/0950
new file mode 100644
index 000000000..0914c99bb
--- /dev/null
+++ b/test/log/0950
@@ -0,0 +1,17 @@
+
+******** SERVER ********
+2017-07-30 18:51:05.712 exim x.yz daemon started: pid=p1234, no queue runs, listening for SMTP on port PORT_D
+2017-07-30 18:51:05.712 SMTP connection from [127.0.0.1] (TCP/IP connection count = 1)
+2017-07-30 18:51:05.712 10HmaX-000000005vi-0000 <= implcit@test.ex H=(tester) [127.0.0.1] P=smtp S=sss for CALLER@test.ex
+2017-07-30 18:51:05.712 10HmaX-000000005vi-0000 => TESTSUITE/test-mail/CALLER <CALLER@test.ex> R=client T=local_file
+2017-07-30 18:51:05.712 10HmaX-000000005vi-0000 Completed
+2017-07-30 18:51:05.712 10HmaY-000000005vi-0000 <= discard@test.ex H=(tester) [127.0.0.1] P=smtp S=sss for CALLER@test.ex
+2017-07-30 18:51:05.712 10HmaY-000000005vi-0000 => discarded <CALLER@test.ex> R=client
+2017-07-30 18:51:05.712 10HmaY-000000005vi-0000 Completed
+2017-07-30 18:51:05.712 10HmaZ-000000005vi-0000 <= identified@test.ex H=(tester) [127.0.0.1] P=smtp S=sss for CALLER@test.ex
+2017-07-30 18:51:05.712 10HmaZ-000000005vi-0000 => TESTSUITE/test-mail/myfolder <CALLER@test.ex> R=client T=local_file
+2017-07-30 18:51:05.712 10HmaZ-000000005vi-0000 Completed
+2017-07-30 18:51:05.712 10HmbA-000000005vi-0000 <= redirect@test.ex H=(tester) [127.0.0.1] P=smtp S=sss for CALLER@test.ex
+2017-07-30 18:51:05.712 SMTP connection from (tester) [127.0.0.1] D=q.qqqs closed by QUIT
+2017-07-30 18:51:05.712 10HmbA-000000005vi-0000 => :blackhole: <fred@some_other_dom.ain> R=discard
+2017-07-30 18:51:05.712 10HmbA-000000005vi-0000 Completed
diff --git a/test/log/5400 b/test/log/5400
index 3b4aad862..099075990 100644
--- a/test/log/5400
+++ b/test/log/5400
@@ -32,8 +32,8 @@
1999-03-02 09:44:33 rcpt for userx@domain.com
1999-03-02 09:44:33 rcpt for special_tpt@domain.com
1999-03-02 09:44:33 10HmbD-000000005vi-0000 <= CALLER@myhost.test.ex U=CALLER P=local-esmtp S=sss for userx@domain.com special_tpt@domain.com
-1999-03-02 09:44:33 10HmbD-000000005vi-0000 => userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbD-000000005vi-0000 => special_tpt@domain.com R=all T=smtp2 H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmbD-000000005vi-0000 => userx@domain.com R=all T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
1999-03-02 09:44:33 10HmbD-000000005vi-0000 Completed
1999-03-02 09:44:33 rcpt for userx@domain1.com
1999-03-02 09:44:33 rcpt for usery@domain2.com
diff --git a/test/mail/0950.CALLER b/test/mail/0950.CALLER
new file mode 100644
index 000000000..cf7c1bc47
--- /dev/null
+++ b/test/mail/0950.CALLER
@@ -0,0 +1,15 @@
+From MAILER-DAEMON Tue Mar 02 09:44:33 1999
+Return-path: <>
+Envelope-to: CALLER@test.ex
+Delivery-date: Tue, 2 Mar 1999 09:44:33 +0000
+Received: from [127.0.0.1] (helo=tester)
+ by myhost.test.ex with smtp (Exim x.yz)
+ (envelope-from <implcit@test.ex>)
+ id 10HmaX-000000005vi-0000
+ for CALLER@test.ex;
+ Tue, 2 Mar 1999 09:44:33 +0000
+From: <good@test.ex>
+Subject: this should be accepted and filed
+
+a single body line
+
diff --git a/test/mail/0950.myfolder b/test/mail/0950.myfolder
new file mode 100644
index 000000000..29352c43c
--- /dev/null
+++ b/test/mail/0950.myfolder
@@ -0,0 +1,14 @@
+From MAILER-DAEMON Tue Mar 02 09:44:33 1999
+Return-path: <>
+Envelope-to: CALLER@test.ex
+Delivery-date: Tue, 2 Mar 1999 09:44:33 +0000
+Received: from [127.0.0.1] (helo=tester)
+ by myhost.test.ex with smtp (Exim x.yz)
+ (envelope-from <identified@test.ex>)
+ id 10HmaZ-000000005vi-0000
+ for CALLER@test.ex;
+ Tue, 2 Mar 1999 09:44:33 +0000
+From: <spot_this@test.ex>
+Subject: this should be delivered to a speicifc place by the filter
+
+
diff --git a/test/runtest b/test/runtest
index 17f7ab4c9..ae2d929fd 100755
--- a/test/runtest
+++ b/test/runtest
@@ -1864,13 +1864,13 @@ if (-e $sf_current)
for (my $i = 0; $i < @munged; $i++)
{
- if ($munged[$i] =~ /^[-\d]{10}\s[:\d]{8}\s[-A-Za-z\d]{16}\s[-=*]>/)
+ if ($munged[$i] =~ /^[-\d]{10}\s[:\d]{8}(\.\d{3})?\s[-A-Za-z\d]{23}\s[-=*]>/)
{
my $j;
for ($j = $i + 1; $j < @munged; $j++)
{
last if $munged[$j] !~
- /^[-\d]{10}\s[:\d]{8}\s[-A-Za-z\d]{16}\s[-=*]>/;
+ /^[-\d]{10}\s[:\d]{8}(\.\d{3})?\s[-A-Za-z\d]{23}\s[-=*]>/;
}
@temp = splice(@munged, $i, $j - $i);
@temp = sort(@temp);
diff --git a/test/scripts/0000-Basic/0950 b/test/scripts/0000-Basic/0950
new file mode 100644
index 000000000..fb7d0056d
--- /dev/null
+++ b/test/scripts/0000-Basic/0950
@@ -0,0 +1,67 @@
+# Sieve filter: basic classify reject/deliver
+#
+exim -bd -DSERVER=server -oX PORT_D
+****
+#
+#
+client 127.0.0.1 PORT_D
+??? 220
+HELO tester
+??? 250
+MAIL FROM:<implcit@test.ex>
+??? 250
+RCPT TO:<CALLER@test.ex>
+??? 250
+DATA
+??? 354
+From: <good@test.ex>
+Subject: this should be accepted and filed
+
+a single body line
+.
+??? 250
+RSET
+??? 250
++++ 1
+MAIL FROM:<discard@test.ex>
+??? 250
+RCPT TO:<CALLER@test.ex>
+??? 250
+DATA
+??? 354
+From: <coyote@test.ex>
+Subject: this should be discarded by the filter
+.
+??? 250
+RSET
+??? 250
++++ 1
+MAIL FROM:<identified@test.ex>
+??? 250
+RCPT TO:<CALLER@test.ex>
+??? 250
+DATA
+??? 354
+From: <spot_this@test.ex>
+Subject: this should be delivered to a speicifc place by the filter
+.
+??? 250
+RSET
+??? 250
++++ 1
+MAIL FROM:<redirect@test.ex>
+??? 250
+RCPT TO:<CALLER@test.ex>
+??? 250
+DATA
+??? 354
+From: <redirect@test.ex>
+Subject: this should be redirected by the filter to a different address
+.
+??? 250
+QUIT
+??? 221
+****
+#
+millisleep 500
+killdaemon
diff --git a/test/stdout/0950 b/test/stdout/0950
new file mode 100644
index 000000000..8a9ae2366
--- /dev/null
+++ b/test/stdout/0950
@@ -0,0 +1,80 @@
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> HELO tester
+??? 250
+<<< 250 myhost.test.ex Hello tester [127.0.0.1]
+>>> MAIL FROM:<implcit@test.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<CALLER@test.ex>
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> From: <good@test.ex>
+>>> Subject: this should be accepted and filed
+>>>
+>>> a single body line
+>>> .
+??? 250
+<<< 250 OK id=10HmaX-000000005vi-0000
+>>> RSET
+??? 250
+<<< 250 Reset OK
++++ 1
+>>> MAIL FROM:<discard@test.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<CALLER@test.ex>
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> From: <coyote@test.ex>
+>>> Subject: this should be discarded by the filter
+>>> .
+??? 250
+<<< 250 OK id=10HmaY-000000005vi-0000
+>>> RSET
+??? 250
+<<< 250 Reset OK
++++ 1
+>>> MAIL FROM:<identified@test.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<CALLER@test.ex>
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> From: <spot_this@test.ex>
+>>> Subject: this should be delivered to a speicifc place by the filter
+>>> .
+??? 250
+<<< 250 OK id=10HmaZ-000000005vi-0000
+>>> RSET
+??? 250
+<<< 250 Reset OK
++++ 1
+>>> MAIL FROM:<redirect@test.ex>
+??? 250
+<<< 250 OK
+>>> RCPT TO:<CALLER@test.ex>
+??? 250
+<<< 250 Accepted
+>>> DATA
+??? 354
+<<< 354 Enter message, ending with "." on a line by itself
+>>> From: <redirect@test.ex>
+>>> Subject: this should be redirected by the filter to a different address
+>>> .
+??? 250
+<<< 250 OK id=10HmbA-000000005vi-0000
+>>> QUIT
+??? 221
+<<< 221 myhost.test.ex closing connection
+End of script