[exim-cvs] Fix filter noerror command. Bug 2318

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Exim Git Commits Mailing List
Fecha:  
A: exim-cvs
Asunto: [exim-cvs] Fix filter noerror command. Bug 2318
Gitweb: https://git.exim.org/exim.git/commitdiff/25beaee4c28ed29a37078e6c68fa3d18ced6ec8c
Commit:     25beaee4c28ed29a37078e6c68fa3d18ced6ec8c
Parent:     13c7874e0a41d696ecf55774d62ea7d11778414f
Author:     Matthias Kurz <m.kurz@???>
AuthorDate: Sun Sep 16 21:20:44 2018 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Sep 16 21:33:40 2018 +0100


    Fix filter noerror command.  Bug 2318
---
 doc/doc-txt/ChangeLog        |  4 ++++
 src/src/rda.c                | 12 +++++++++---
 test/aux-fixed/0616.filter   |  3 +++
 test/aux-fixed/0617.filter   |  3 +++
 test/confs/0616              | 40 ++++++++++++++++++++++++++++++++++++++++
 test/confs/0617              | 40 ++++++++++++++++++++++++++++++++++++++++
 test/log/0617                |  9 +++++++++
 test/scripts/0000-Basic/0616 | 25 +++++++++++++++++++++++++
 test/scripts/0000-Basic/0617 | 25 +++++++++++++++++++++++++
 test/stdout/0616             | 30 ++++++++++++++++++++++++++++++
 test/stdout/0617             | 30 ++++++++++++++++++++++++++++++
 11 files changed, 218 insertions(+), 3 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 5f45d69..617e407 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -108,6 +108,10 @@ JH/22 Bug 1896: Fix the envelope from for DMARC forensic reports to be possibly
       non-null, to avoid issues with sites running BATV.  Previously reports were
       sent with an empty envelope sender so looked like bounces.


+JH/23 Bug 2318: Fix the noerror command within filters.  It wasn't working.
+      The ignore_error flag wasn't being returned from the filter subprocess so
+      was not set for later routers.  Investigation and fix by Matthias Kurz.
+


 Exim version 4.91
 -----------------
diff --git a/src/src/rda.c b/src/src/rda.c
index ee7c1fe..8962dba 100644
--- a/src/src/rda.c
+++ b/src/src/rda.c
@@ -718,11 +718,13 @@ if ((pid = fork()) == 0)
     for (addr = *generated; addr; addr = addr->next)
       {
       int reply_options = 0;
+      int ig_err = addr->prop.ignore_error ? 1 : 0;


       if (  rda_write_string(fd, addr->address) != 0
          || write(fd, &addr->mode, sizeof(addr->mode)) != sizeof(addr->mode)
          || write(fd, &addr->flags, sizeof(addr->flags)) != sizeof(addr->flags)
          || rda_write_string(fd, addr->prop.errors_address) != 0
+         || write(fd, &ig_err, sizeof(ig_err)) != sizeof(ig_err)
      )
     goto bad;


@@ -887,9 +889,13 @@ if (yield == FF_DELIVERED || yield == FF_NOTDELIVERED ||

     /* Next comes the mode and the flags fields */


-    if (read(fd, &addr->mode, sizeof(addr->mode)) != sizeof(addr->mode) ||
-        read(fd, &addr->flags, sizeof(addr->flags)) != sizeof(addr->flags) ||
-        !rda_read_string(fd, &addr->prop.errors_address)) goto DISASTER;
+    if (  read(fd, &addr->mode, sizeof(addr->mode)) != sizeof(addr->mode)
+       || read(fd, &addr->flags, sizeof(addr->flags)) != sizeof(addr->flags)
+       || !rda_read_string(fd, &addr->prop.errors_address)
+       || read(fd, &i, sizeof(i)) != sizeof(i)
+       )
+      goto DISASTER;
+    addr->prop.ignore_error = (i != 0);


     /* Next comes a possible setting for $thisaddress and any numerical
     variables for pipe expansion, terminated by a NULL string. The maximum
diff --git a/test/aux-fixed/0616.filter b/test/aux-fixed/0616.filter
new file mode 100644
index 0000000..283d823
--- /dev/null
+++ b/test/aux-fixed/0616.filter
@@ -0,0 +1,3 @@
+# Exim filter
+
+unseen noerror deliver usery@domain1
diff --git a/test/aux-fixed/0617.filter b/test/aux-fixed/0617.filter
new file mode 100644
index 0000000..394d1b2
--- /dev/null
+++ b/test/aux-fixed/0617.filter
@@ -0,0 +1,3 @@
+# Exim filter
+
+unseen deliver usery@domain1
diff --git a/test/confs/0616 b/test/confs/0616
new file mode 100644
index 0000000..e710a4b
--- /dev/null
+++ b/test/confs/0616
@@ -0,0 +1,40 @@
+# Exim test configuration 0616
+
+.include DIR/aux-var/std_conf_prefix
+
+# ----- Routers -----
+
+begin routers
+
+route_userx:
+  driver = redirect
+  local_parts = userx
+  errors_to = dump@domain1
+  allow_filter
+  file = DIR/aux-fixed/TESTNUM.filter
+  user = EXIMUSER
+  no_more
+
+dump_bounces:
+  driver = redirect
+  local_parts = dump
+  data = :blackhole:
+  no_more
+
+route_smtp:
+  driver = manualroute
+  route_list = * 127.0.0.1 byname
+  errors_to = dump@domain1
+  self = send
+  transport = smtp
+  no_more
+
+# ----- Transports -----
+
+begin transports
+
+smtp:
+  driver = smtp
+  port = PORT_S
+
+# End
diff --git a/test/confs/0617 b/test/confs/0617
new file mode 100644
index 0000000..cf52517
--- /dev/null
+++ b/test/confs/0617
@@ -0,0 +1,40 @@
+# Exim test configuration 0617
+
+.include DIR/aux-var/std_conf_prefix
+
+# ----- Routers -----
+
+begin routers
+
+route_userx:
+  driver = redirect
+  local_parts = userx
+  errors_to = dump@domain1
+  allow_filter
+  file = DIR/aux-fixed/TESTNUM.filter
+  user = EXIMUSER
+  no_more
+
+dump_bounces:
+  driver = redirect
+  local_parts = dump
+  data = :blackhole:
+  no_more
+
+route_smtp:
+  driver = manualroute
+  route_list = * 127.0.0.1 byname
+  errors_to = dump@domain1
+  self = send
+  transport = smtp
+  no_more
+
+# ----- Transports -----
+
+begin transports
+
+smtp:
+  driver = smtp
+  port = PORT_S
+
+# End
diff --git a/test/log/0617 b/test/log/0617
new file mode 100644
index 0000000..865db79
--- /dev/null
+++ b/test/log/0617
@@ -0,0 +1,9 @@
+1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@??? U=CALLER P=local S=sss
+1999-03-02 09:44:33 Start queue run: pid=pppp -qqf
+1999-03-02 09:44:33 10HmaX-0005vi-00 => userx@domain1 R=route_smtp T=smtp H=127.0.0.1 [127.0.0.1] C="250 OK"
+1999-03-02 09:44:33 10HmaX-0005vi-00 ** usery@domain1 <userx@domain1> R=route_smtp T=smtp H=127.0.0.1 [127.0.0.1]: SMTP error from remote mail server after RCPT TO:<usery@domain1>: 550 Not that one
+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 => :blackhole: <dump@domain1> R=dump_bounces
+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 End queue run: pid=pppp -qqf
diff --git a/test/scripts/0000-Basic/0616 b/test/scripts/0000-Basic/0616
new file mode 100644
index 0000000..4ac173d
--- /dev/null
+++ b/test/scripts/0000-Basic/0616
@@ -0,0 +1,25 @@
+# Filter file which makes use of "unseen noerror deliver" commands
+#
+exim -odq userx@domain1
+This message will also be delivered to usery
+****
+server PORT_S
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL
+250 OK
+RCPT
+250 OK
+RCPT
+550 Not that one
+DATA
+354 More...
+.
+250 OK
+QUIT
+220 OK
+****
+exim -qqf
+****
diff --git a/test/scripts/0000-Basic/0617 b/test/scripts/0000-Basic/0617
new file mode 100644
index 0000000..352c757
--- /dev/null
+++ b/test/scripts/0000-Basic/0617
@@ -0,0 +1,25 @@
+# Filter file which makes use of "unseen deliver" commands
+#
+exim -odq userx@domain1
+This message will also be delivered to usery
+****
+server PORT_S
+220 ESMTP
+EHLO
+250-OK
+250 HELP
+MAIL
+250 OK
+RCPT
+250 OK
+RCPT
+550 Not that one
+DATA
+354 More...
+.
+250 OK
+QUIT
+220 OK
+****
+exim -qqf
+****
diff --git a/test/stdout/0616 b/test/stdout/0616
new file mode 100644
index 0000000..369cf7f
--- /dev/null
+++ b/test/stdout/0616
@@ -0,0 +1,30 @@
+
+******** SERVER ********
+Listening on port 1224 ... 
+Connection request from [127.0.0.1]
+220 ESMTP
+EHLO the.local.host.name
+250-OK
+250 HELP
+MAIL FROM:<dump@domain1>
+250 OK
+RCPT TO:<userx@domain1>
+250 OK
+RCPT TO:<usery@domain1>
+550 Not that one
+DATA
+354 More...
+Received: from CALLER by the.local.host.name with local (Exim x.yz)
+    (envelope-from <CALLER@???>)
+    id 10HmaX-0005vi-00
+    for userx@domain1; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@???>
+From: CALLER_NAME <CALLER@???>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+This message will also be delivered to usery
+.
+250 OK
+QUIT
+220 OK
+End of script
diff --git a/test/stdout/0617 b/test/stdout/0617
new file mode 100644
index 0000000..369cf7f
--- /dev/null
+++ b/test/stdout/0617
@@ -0,0 +1,30 @@
+
+******** SERVER ********
+Listening on port 1224 ... 
+Connection request from [127.0.0.1]
+220 ESMTP
+EHLO the.local.host.name
+250-OK
+250 HELP
+MAIL FROM:<dump@domain1>
+250 OK
+RCPT TO:<userx@domain1>
+250 OK
+RCPT TO:<usery@domain1>
+550 Not that one
+DATA
+354 More...
+Received: from CALLER by the.local.host.name with local (Exim x.yz)
+    (envelope-from <CALLER@???>)
+    id 10HmaX-0005vi-00
+    for userx@domain1; Tue, 2 Mar 1999 09:44:33 +0000
+Message-Id: <E10HmaX-0005vi-00@???>
+From: CALLER_NAME <CALLER@???>
+Date: Tue, 2 Mar 1999 09:44:33 +0000
+
+This message will also be delivered to usery
+.
+250 OK
+QUIT
+220 OK
+End of script