[exim-dev] [Bug 159] Wildcarding in headers_remove

Top Page
Delete this message
Reply to this message
Author: admin
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 159] Wildcarding in headers_remove
https://bugs.exim.org/show_bug.cgi?id=159

Git Commit <git@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |git@???


--- Comment #15 from Git Commit <git@???> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/258dfd012173250b20520c8fb24329eb8998970a

commit 258dfd012173250b20520c8fb24329eb8998970a
Author:     Peder Stray <peder.stray@???>
AuthorDate: Mon Feb 3 14:35:03 2020 +0000
Commit:     Jeremy Harris <jgh146exb@???>
CommitDate: Mon Feb 3 15:52:27 2020 +0000


    Support tail-glob in headers_remove.  Bug 159
---
 doc/doc-docbook/spec.xfpt |  6 ++++--
 src/src/transport.c       | 15 +++++++++++----
 2 files changed, 15 insertions(+), 6 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index 410a166..aed9764 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -18654,8 +18654,10 @@ avoided. The &%repeat_use%& option of the &%redirect%&
router may be of help.
 This option specifies a list of text headers,
 colon-separated (by default, changeable in the usual way
&<<SECTlistsepchange>>&),
 that is associated with any addresses that are accepted by the router.
-Each item is separately expanded, at routing time.  However, this
-option has no effect when an address is just being verified. The way in which
+However, the option has no effect when an address is just being verified.
+Each list item is separately expanded, at routing time.
+If an item ends in *, it will match any header with the same prefix.
+The way in which
 the text is used to remove header lines at transport time is described in
 section &<<SECTheadersaddrem>>&. Header lines are not actually removed until
 the message is in the process of being transported. This means that references
diff --git a/src/src/transport.c b/src/src/transport.c
index ed3dcf0..02994d2 100644
--- a/src/src/transport.c
+++ b/src/src/transport.c
@@ -738,10 +738,17 @@ for (header_line * h = header_list; h; h = h->next) if
(h->type != htype_old)
         return FALSE;
         }
     len = s ? Ustrlen(s) : 0;
-    if (strncmpic(h->text, s, len) != 0) continue;
-    ss = h->text + len;
-    while (*ss == ' ' || *ss == '\t') ss++;
-    if (*ss == ':') break;
+    if (len && s[len-1] == '*')    /* trailing glob */
+      {
+      if (strncmpic(h->text, s, len-1) == 0) break;
+      }
+    else
+      {
+      if (strncmpic(h->text, s, len) != 0) continue;
+      ss = h->text + len;
+      while (*ss == ' ' || *ss == '\t') ss++;
+      if (*ss == ':') break;
+      }
     }
       if (s) { include_header = FALSE; break; }
       }


--
You are receiving this mail because:
You are the QA Contact for the bug.