[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: duplicate headers -- subject/content-type
From: |
Dan Nelson |
Subject: |
Re: duplicate headers -- subject/content-type |
Date: |
Wed, 18 Sep 2002 12:11:29 -0500 |
User-agent: |
Mutt/1.5.1i |
In the last episode (Sep 18), Cowles, Steve said:
> I'm running sendmail-8.12.5 with spamass-milter-0.1.2 along with
> spamassassin.2.41. Sendmail is configured to relay all inbound e-mails to
> our Exchange server using a mailertable entry (no local delivery). Had no
> problems installing or configuring SA/spamass-milter, but I am getting
> multiple header entries when spamassassin tags an e-mail as spam. e.g
>
> Subject: Save 75% off Printer Inks Only for a Limited Time
> Subject: Save 75% off Printer Inks Only for a Limited Time
> Mime-Version: 1.0
> Content-Type: text/html
> Content-Type: text/html
>
>
> After looking at the milter code, I "think" I have found the source
> of this problem, but my programming/debugging skills are limited
> (anyway, see below). Based on my understanding of the milter code,
> this looks like it could be a SA return value problem, perl libs or
> simply an invalid test within the milter. I can't really tell. Thus
> the reason I'm making this post.
Yeah, the code is broken :) Something like this should work better.
I'll test it myself tonight and if it works i'll put it in CVS.
Index: spamass-milter.cpp
===================================================================
RCS file: /cvsroot/spamass-milt/spamass-milt/spamass-milter.cpp,v
retrieving revision 1.15
diff -u -r1.15 spamass-milter.cpp
--- spamass-milter.cpp 28 Aug 2002 16:54:03 -0000 1.15
+++ spamass-milter.cpp 18 Sep 2002 17:09:29 -0000
@@ -316,13 +316,16 @@
old = assassin->set_subject(oldstring);
+ if (newstring != oldstring)
+ {
// change if old one was present, append if non-null
- if (old > 0 && newstring != oldstring)
+ if (old > 0)
smfi_chgheader(ctx,"Subject",1,newstring.size() > 0 ?
const_cast<char*>(newstring.c_str()) : NULL );
else if (newstring.size()>0)
smfi_addheader(ctx, "Subject",
const_cast<char*>(newstring.c_str()));
+ }
// Content-Type header //
@@ -332,13 +335,16 @@
old = assassin->set_content_type(oldstring);
+ if (newstring != oldstring)
+ {
// change if old one was present, append if non-null
- if (old > 0 && newstring != oldstring)
+ if (old > 0)
smfi_chgheader(ctx,"Content-Type",1,newstring.size() > 0 ?
const_cast<char*>(newstring.c_str()) : NULL );
else if (newstring.size()>0)
smfi_addheader(ctx, "Content-Type",
const_cast<char*>(newstring.c_str()));
+ }
// Replace body with the one SpamAssassin provided //
--
Dan Nelson
address@hidden