[exim-dev] [Bug 1452] New: bugs in headers_add and headers_r…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Heiko Schlichting
Päiväys:  
Vastaanottaja: exim-dev
Aihe: [exim-dev] [Bug 1452] New: bugs in headers_add and headers_remove
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1452
           Summary: bugs in headers_add and headers_remove
           Product: Exim
           Version: 4.82
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: bug
          Priority: medium
         Component: Transports
        AssignedTo: nigel@???
        ReportedBy: heiko@???
                CC: exim-dev@???



Created an attachment (id=702)
--> (http://bugs.exim.org/attachment.cgi?id=702)
idea for fixing adding/removing headers

"headers_add" and "headers_remove" options give sometimes unexpected results:

(1) headers_add

------ good: -------
remote_smtp:
driver = smtp
headers_add = ${if bool{true} {X-Test1: eins}}
headers_add = X-Test2: zwei

added header line(s):
X-Test1: eins
X-Test2: zwei

------ bad: -------
remote_smtp:
driver = smtp
headers_add = ${if bool{false} {X-Test1: eins}}
headers_add = X-Test2: zwei

added header line(s):

X-Test2: zwei

Exim inserts a blank line before "X-Test2: zwei". So this and all the following
lines are now part of the BODY of the mail causing a lot of troubles including
wrong signatures for S/MIME signed messages.

(2) headers_remove

------ good: -------
remote_smtp:
driver = smtp
headers_remove = ${if bool{true} {X-Test1}}
headers_remove = ${if bool{true} {X-Test2}}
headers_remove = ${if bool{true} {X-Test3}}

removed header line:
X-Test1: eins

------ bad: -------
remote_smtp:
driver = smtp
headers_remove = ${if bool{true} {X-Test1}}
headers_remove = ${if bool{false} {X-Test2}}
headers_remove = ${if bool{true} {X-Test3}}

Does NOT remove X-Test1! But if the third(!) line is missing, X-Test1 header
gets removed again.


In both cases the problems are caused by handling of separators. For adding
headers it is "\n" which should be removed at the beginning and there should be
no consecutive "\n". For removing headers the separator is ":" as in exim
lists. An empty result of an expression generates "::" which is no longer a
separator but treated as a literal colon. Therefore consecutive ":" should be
squeezed.

Attached you find a git format patch against exim HEAD (930407f). It is not the
right coding style, has bogus markers and German comments. Treat it only as an
idea. It fixes both problems for me but must be written in a cleaner, exim
conform way. I'm not absolutely sure that it causes no side effects.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email