Vladimir Vassiliev:
> Hi,
> 
> it's a question more like to developers.
> I'm using commercial anti-spam Milter. It adds some headers to message, 
> particularly, 
> X-SpamTest-Status and X-SpamTest-Status-Extended. Problem is that only latter 
> of these two appears 
> in message. More of it, two copies of these header are added to message.
> Problem appears only for this two headers.
> Can this be a bug in Postfix (for example, something with substring search)?

This was caused by a length check against the wrong string (the
header name that was found, instead of the header name that was
wanted).

I notice that this application does a lot of

        ADDHEADER   header1 value1
        CHGHEADER 1 header1 value1
        ADDHEADER   header2 value2
        CHGHEADER 2 header2 value2
        ADDHEADER   header3 value3
        CHGHEADER 3 header3 value3

And so on, i.e. the application adds a header and replaces it with
the same value.  I have added this as a test case to the source
code so it won't happen again.

As a workaround, the application could send just the ADDHEADER
requests, without the CHGHEADER requests that replace a header
by the same text.

        Wietse

diff --exclude=man --exclude=html --exclude=README_FILES --exclude=.indent.pro 
--exclude=Makefile.in -cr 
/var/tmp/postfix-2.10-20120130/src/cleanup/cleanup_milter.c ./cleanup_milter.c
*** /var/tmp/postfix-2.10-20120130/src/cleanup/cleanup_milter.c Sat Jan 14 
20:39:14 2012
--- ./cleanup_milter.c  Thu Feb  2 09:35:03 2012
***************
*** 845,852 ****
             /* Reset the saved PTR record and update last_type. */ ;
        else if ((header_label == 0
                  || (strncasecmp(header_label, STR(buf), len) == 0
!                     && (IS_SPACE_TAB(STR(buf)[len])
!                         || STR(buf)[len] == ':')))
                 && --index == 0) {
            /* If we have a saved PTR record, it points to start of header. */
            break;
--- 845,851 ----
             /* Reset the saved PTR record and update last_type. */ ;
        else if ((header_label == 0
                  || (strncasecmp(header_label, STR(buf), len) == 0
!                     && (strlen(header_label) == len)))
                 && --index == 0) {
            /* If we have a saved PTR record, it points to start of header. */
            break;

Reply via email to