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)
{
}
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;
}
)
{
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)
-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;
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;
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;
}
}
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
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)
{
}
}
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;
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)
#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;
}
--- /dev/null
+# 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";
+}
--- /dev/null
+# 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
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**
--- /dev/null
+
+******** 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
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
--- /dev/null
+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
+
--- /dev/null
+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
+
+
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);
--- /dev/null
+# 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
--- /dev/null
+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