summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/sieve.c53
-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
11 files changed, 295 insertions, 29 deletions
diff --git a/src/src/sieve.c b/src/src/sieve.c
index 4793d5756..74d008568 100644
--- a/src/src/sieve.c
+++ b/src/src/sieve.c
@@ -831,23 +831,23 @@ int r=0;
if ((filter_test != FTEST_NONE && debug_selector != 0) ||
(debug_selector & D_filter) != 0)
{
- debug_printf("String comparison (match ");
+ debug_printf_indent("String comparison (match ");
switch (mt)
{
- case MATCH_IS: debug_printf(":is"); break;
- case MATCH_CONTAINS: debug_printf(":contains"); break;
- case MATCH_MATCHES: debug_printf(":matches"); break;
+ case MATCH_IS: debug_printf_indent(":is"); break;
+ case MATCH_CONTAINS: debug_printf_indent(":contains"); break;
+ case MATCH_MATCHES: debug_printf_indent(":matches"); break;
}
- debug_printf(", comparison \"");
+ debug_printf_indent(", comparison \"");
switch (co)
{
- case COMP_OCTET: debug_printf("i;octet"); break;
- case COMP_EN_ASCII_CASEMAP: debug_printf("en;ascii-casemap"); break;
- case COMP_ASCII_NUMERIC: debug_printf("i;ascii-numeric"); break;
+ case COMP_OCTET: debug_printf_indent("i;octet"); break;
+ case COMP_EN_ASCII_CASEMAP: debug_printf_indent("en;ascii-casemap"); break;
+ case COMP_ASCII_NUMERIC: debug_printf_indent("i;ascii-numeric"); break;
}
- debug_printf("\"):\n");
- debug_printf(" Search = %s (%d chars)\n", needle->character,needle->length);
- debug_printf(" Inside = %s (%d chars)\n", haystack->character,haystack->length);
+ debug_printf_indent("\"):\n");
+ debug_printf_indent(" Search = %s (%d chars)\n", needle->character,needle->length);
+ debug_printf_indent(" Inside = %s (%d chars)\n", haystack->character,haystack->length);
}
switch (mt)
{
@@ -917,7 +917,7 @@ switch (mt)
}
if ((filter_test != FTEST_NONE && debug_selector != 0) ||
(debug_selector & D_filter) != 0)
- debug_printf(" Result %s\n",r?"true":"false");
+ debug_printf_indent(" Result %s\n",r?"true":"false");
return r;
}
@@ -1039,13 +1039,13 @@ for (new_addr = *generated; new_addr; new_addr = new_addr->next)
)
{
if ((filter_test != FTEST_NONE && debug_selector != 0) || (debug_selector & D_filter) != 0)
- debug_printf("Repeated %s `%s' ignored.\n",file ? "fileinto" : "redirect", addr);
+ debug_printf_indent("Repeated %s `%s' ignored.\n",file ? "fileinto" : "redirect", addr);
return;
}
if ((filter_test != FTEST_NONE && debug_selector != 0) || (debug_selector & D_filter) != 0)
- debug_printf("%s `%s'\n",file ? "fileinto" : "redirect", addr);
+ debug_printf_indent("%s `%s'\n",file ? "fileinto" : "redirect", addr);
new_addr = deliver_make_addr(addr,TRUE);
if (file)
@@ -2653,7 +2653,8 @@ Returns: 2 success by stop
-1 syntax or execution error
*/
-static int parse_block(struct Sieve *filter, int exec,
+static int
+parse_block(struct Sieve *filter, int exec,
address_item **generated)
{
int r;
@@ -2745,7 +2746,7 @@ while (*filter->pc)
if ((filter_test != FTEST_NONE && debug_selector != 0) ||
(debug_selector & D_filter) != 0)
{
- if (exec) debug_printf("if %s\n",cond?"true":"false");
+ if (exec) debug_printf_indent("if %s\n",cond?"true":"false");
}
m=parse_block(filter,exec ? cond : 0, generated);
if (m==-1 || m==2) return m;
@@ -2771,7 +2772,7 @@ while (*filter->pc)
if ((filter_test != FTEST_NONE && debug_selector != 0) ||
(debug_selector & D_filter) != 0)
{
- if (exec) debug_printf("elsif %s\n",cond?"true":"false");
+ if (exec) debug_printf_indent("elsif %s\n",cond?"true":"false");
}
m=parse_block(filter,exec && unsuccessful ? cond : 0, generated);
if (m==-1 || m==2) return m;
@@ -3104,16 +3105,16 @@ while (*filter->pc)
}
}
if ((filter_test != FTEST_NONE && debug_selector != 0) || debug_selector & D_filter)
- debug_printf("Notification to `%s': '%s'.\n",method.character,message.length!=-1 ? message.character : CUS "");
+ debug_printf_indent("Notification to `%s': '%s'.\n",method.character,message.length!=-1 ? message.character : CUS "");
#endif
}
else
if ((filter_test != FTEST_NONE && debug_selector != 0) || debug_selector & D_filter)
- debug_printf("Repeated notification to `%s' ignored.\n",method.character);
+ debug_printf_indent("Repeated notification to `%s' ignored.\n",method.character);
}
else
if ((filter_test != FTEST_NONE && debug_selector != 0) || debug_selector & D_filter)
- debug_printf("Ignoring notification, triggering message contains Auto-submitted: field.\n");
+ debug_printf_indent("Ignoring notification, triggering message contains Auto-submitted: field.\n");
}
}
#endif
@@ -3281,7 +3282,7 @@ while (*filter->pc)
for (int i = 0; i < 16; i++) sprintf(CS (hexdigest+2*i), "%02X", digest[i]);
if ((filter_test != FTEST_NONE && debug_selector != 0) || (debug_selector & D_filter) != 0)
- debug_printf("Sieve: mail was personal, vacation file basename: %s\n", hexdigest);
+ debug_printf_indent("Sieve: mail was personal, vacation file basename: %s\n", hexdigest);
if (filter_test == FTEST_NONE)
{
@@ -3362,7 +3363,7 @@ while (*filter->pc)
}
}
else if ((filter_test != FTEST_NONE && debug_selector != 0) || (debug_selector & D_filter) != 0)
- debug_printf("Sieve: mail was not personal, vacation would ignore it\n");
+ debug_printf_indent("Sieve: mail was not personal, vacation would ignore it\n");
}
}
else break;
@@ -3554,7 +3555,8 @@ struct Sieve sieve;
int r;
uschar * msg;
-DEBUG(D_route) debug_printf("Sieve: start of processing\n");
+DEBUG(D_route) debug_printf_indent("Sieve: start of processing\n");
+expand_level++;
sieve.filter = filter;
if (!vacation_directory)
@@ -3611,9 +3613,10 @@ else
#ifndef COMPILE_SYNTAX_CHECKER
if (filter_test != FTEST_NONE) printf("%s\n", (const char*) msg);
- else debug_printf("%s\n", msg);
+ else debug_printf_indent("%s\n", msg);
#endif
-DEBUG(D_route) debug_printf("Sieve: end of processing\n");
+expand_level--;
+DEBUG(D_route) debug_printf_indent("Sieve: end of processing\n");
return r;
}
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