Mailing List Archive

[Bug 159] Wildcarding in headers_remove
https://bugs.exim.org/show_bug.cgi?id=159

Jeremy Harris <jgh146exb@wizmail.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |jgh146exb@wizmail.org

--- Comment #5 from Jeremy Harris <jgh146exb@wizmail.org> ---
*** Bug 2514 has been marked as a duplicate of this bug. ***

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #6 from Peder Stray <peder.stray@gmail.com> ---
Created attachment 1263
--> https://bugs.exim.org/attachment.cgi?id=1263&action=edit
Fix for glob support and expandos generating lists

Here is a patch that i think will fix this bug. It implements support for a *
at the end of a header to match prefixes, and fixes so that expandos are done
before the list is split to allow for inclusion of variables or other
expansions that result in lists themselves.

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #7 from Jeremy Harris <jgh146exb@wizmail.org> ---
Comment on attachment 1263
--> https://bugs.exim.org/attachment.cgi?id=1263
Fix for glob support and expandos generating lists

Breaks testcase 97 (and unaccceptably changes the documented behaviour)

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #8 from Peder Stray <peder.stray@gmail.com> ---
(In reply to Jeremy Harris from comment #7)
> Comment on attachment 1263 [details]
> Fix for glob support and expandos generating lists
>
> Breaks testcase 97 (and unaccceptably changes the documented behaviour)

Feel to elaboarte on that testcase? (As i'm not _that_ familiar with the full
source yet)

And of course, implementing something new will change documentation, but I
think I changed the docs too, but still, how headers_remove does splitting
seems to be the only place (at least that i found) that does it in that order.

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #9 from Jeremy Harris <jgh146exb@wizmail.org> ---
The separate expansion of each list item is documented. Don't change that.

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #10 from Peder Stray <peder.stray@gmail.com> ---
(In reply to Jeremy Harris from comment #9)
> The separate expansion of each list item is documented. Don't change that.

Yes, I know it will change the documented behaviour from i the strictest sense.
But unless there is something I have missed, how does the change really change
the effective usage? Won't expanding the whole line produce the same the same
string as expanding each one by one, just adding the functionality of beeing
able to store a list of headers in a variable from an ACL or some other lookup?
If you try to do that now, it just fails silently since no headers would match
that string in such a case.

I am totally open for the possibility that there is something I missed, but if
so, I would like to know how this change could break current configs.

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #11 from Jeremy Harris <jgh146exb@wizmail.org> ---
Currently an expansion in a list-element must avoid looking like it contains a
list separator. That means it's common to have doubled colons. If you expand
that (with your coding) before splitting the list into elements, the expansion
fails. So a current correct config becomes broken.

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #12 from Peder Stray <peder.stray@gmail.com> ---
(In reply to Jeremy Harris from comment #11)
> Currently an expansion in a list-element must avoid looking like it contains
> a
> list separator. That means it's common to have doubled colons. If you
> expand
> that (with your coding) before splitting the list into elements, the
> expansion
> fails. So a current correct config becomes broken.

Ah, yes, that could be a problem I guess :) What do you think would be the
best way to handle that?

From what I could gather from the docs (it was documented as an exception),
this place is the only place where splitting is done before expansion? That is
a bit unintuitive.

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

Jeremy Harris <jgh146exb@wizmail.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Comment #13 is|1 |0
private| |

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

Peder Stray <peder.stray@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #1263|0 |1
is obsolete| |

--- Comment #14 from Peder Stray <peder.stray@gmail.com> ---
Created attachment 1270
--> https://bugs.exim.org/attachment.cgi?id=1270&action=edit
Fix for glob support

This patch only adds the glob support to headers_remove, nothing else :)

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

Jeremy Harris <jgh146exb@wizmail.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

Git Commit <git@exim.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |git@exim.org

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

commit 258dfd012173250b20520c8fb24329eb8998970a
Author: Peder Stray <peder.stray@gmail.com>
AuthorDate: Mon Feb 3 14:35:03 2020 +0000
Commit: Jeremy Harris <jgh146exb@wizmail.org>
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.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
[Bug 159] Wildcarding in headers_remove [ In reply to ]
https://bugs.exim.org/show_bug.cgi?id=159

--- Comment #16 from Git Commit <git@exim.org> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/6656a75a7b16170afdbbf4ac558f56f4e0ef75ac

commit 6656a75a7b16170afdbbf4ac558f56f4e0ef75ac
Author: Jeremy Harris <jgh146exb@wizmail.org>
AuthorDate: Mon Feb 3 15:30:43 2020 +0000
Commit: Jeremy Harris <jgh146exb@wizmail.org>
CommitDate: Mon Feb 3 15:52:36 2020 +0000

testsuite: headers_remove globbing. bug 159
----
doc/doc-docbook/spec.xfpt | 24 ++++++++++++++++--------
doc/doc-txt/NewStuff | 4 ++++
test/confs/0481 | 2 +-
test/mail/0481.userx | 1 +
test/scripts/0000-Basic/0481 | 5 +++++
5 files changed, 27 insertions(+), 9 deletions(-)

--
You are receiving this mail because:
You are the QA Contact for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##