Debian Bug report logs - #509901
turn REJECT into DISCARD when Precedence: (list|junk|bulk) header present

version graph

Package: spamass-milter; Maintainer for spamass-milter is Don Armstrong <don@debian.org>; Source for spamass-milter is src:spamass-milter.

Reported by: Jeroen Massar <jeroen@unfix.org>

Date: Sat, 27 Dec 2008 15:36:02 UTC

Severity: wishlist

Tags: patch

Found in version spamass-milter/0.3.1-7

Forwarded to https://savannah.nongnu.org/support/?106593

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Don Armstrong <don@debian.org>:
Bug#509901; Package spamass-milter. (Sat, 27 Dec 2008 15:36:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jeroen Massar <jeroen@unfix.org>:
New Bug report received and forwarded. Copy sent to Don Armstrong <don@debian.org>. (Sat, 27 Dec 2008 15:36:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Jeroen Massar <jeroen@unfix.org>
To: submit@bugs.debian.org
Subject: Patch for spamass-milter to make a REJECT with "Precedence: List" into a DISCARD - Solves Debian List Spam Forwarding issue to people who do do spam checking
Date: Sat, 27 Dec 2008 16:33:48 +0100
[Message part 1 (text/plain, inline)]
Package: spamass-milter
Version: 0.3.1-7

In reference to:
http://lists.debian.org/debian-project/2008/12/msg00151.html
8<----------------------------------------------------------------------------------
If you sign up for mail from mailing lists, just discard mail that you
don't want to read that comes in from us with Priority: bulk or List-*
headers instead of bouncing it. A mailing list is little more than a
glorified mail forwarder: bouncing forwarded mail is wrong.
---------------------------------------------------------------------------------->8
(Co-incidence that the author of that text is the package maintainer for
this package)

Find attached a patch which turns a REJECT into a DISCARD when a
"Precedence: List" header is present.

I took http://mit.edu/network/spam/examples/britney.txt and pre-pended a
  "Precendence: List" header to it, telneted into the box on 25
EHLO,MAIL FROM,RCPT TO,DATA,<paste> and as result:

Dec 27 15:25:39 abaddon spamd[31168]: spamd: identified spam (11.7/5.0)
for jeroen:108 in 5.1 seconds, 1199 bytes.
Dec 27 15:25:39 abaddon spamd[31168]: spamd: result: Y 11 -
BAYES_60,DATE_IN_PAST_24_48,FH_FROMEML_NOTLD,HTML_MESSAGE,HTML_MISSING_CTYPE,HTML_TAG_BALANCE_BODY,INVALID_DATE,MISSING_MIME_HB_SEP,NORMAL_HTTP_TO_IP,RDNS_NONE
scantime=5.1,size=1199,user=jeroen,uid=108,required_score=5.0,rhost=localhost,raddr=127.0.0.1,rport=9814,mid=<200106110439.AAA06179@pacific-carrier-annex.mit.edu>,bayes=0.790679,autolearn=no
Dec 27 15:25:39 abaddon postfix/cleanup[32588]: 99F0135A523:
milter-discard: END-OF-MESSAGE from
noc.sixxs.net[2001:838:1:1:210:dcff:fe20:7c7c]: milter triggers DISCARD
action; from=<testink@unfix.org> to=<jeroen@unfix.org> proto=ESMTP
helo=<noc.sixxs.net>

Please apply this patch to spamass-milter so that I don't get unsubbed
anymore from Debian mailinglists because they are forwarding spam and spam.

Greets,
 Jeroen
[spamass-milter-0.3.1-precedence.diff (text/plain, inline)]
diff -u spamass-milter-0.3.1/spamass-milter.cpp spamass-milter-0.3.1-precedence/spamass-milter.cpp
--- spamass-milter-0.3.1/spamass-milter.cpp	2007-10-02 00:06:23.000000000 +0200
+++ spamass-milter-0.3.1-precedence/spamass-milter.cpp	2008-12-27 16:20:04.000000000 +0100
@@ -455,10 +455,25 @@
 				do_reject = true;
 		}
 	}
+
 	if (do_reject)
 	{
-		debug(D_MISC, "Rejecting");
-		smfi_setreply(ctx, "550", "5.7.1", "Blocked by SpamAssassin");
+		// Change Reject into a DISCARD when the Precedence is List
+		// This stops us from bouncing towards mailing lists
+		// See bottom of http://lists.debian.org/debian-project/2008/12/msg00151.html
+		// Added by Jeroen Massar
+		if (cmp_nocase_partial("List", assassin->precedence()) == 0) do_reject = false;
+
+		if (do_reject)
+		{
+			debug(D_MISC, "Rejecting");
+			smfi_setreply(ctx, "550", "5.7.1", "Blocked by SpamAssassin");
+		}
+		else
+		{
+			debug(D_MISC, "Discarding");
+			/* No reply here, we just throw it out of the door */
+		}
 
 
 		if (flag_bucket)
@@ -521,7 +536,9 @@
 			free(buf);
 #endif 
 		}
-		return SMFIS_REJECT;
+
+		/* To Reject or To Discard, that is the question */
+		return do_reject ? SMFIS_REJECT : SMFIS_DISCARD;
 	}
   }
 
@@ -1085,6 +1102,12 @@
        };
      }
 
+  // Is it a Precedence header?
+  if ( cmp_nocase_partial("Precedence", headerf) == 0 )
+  {
+	assassin->set_precedence(headerv);
+  }
+
   // Is it a "X-Spam-" header field?
   if ( cmp_nocase_partial("X-Spam-", headerf) == 0 )
     {
@@ -1644,6 +1667,12 @@
 }
 
 string& 
+SpamAssassin::precedence()
+{
+  return x_precedence;
+}
+
+string& 
 SpamAssassin::spam_report()
 {
   return x_spam_report;
@@ -1776,6 +1805,14 @@
 }
 
 string::size_type
+SpamAssassin::set_precedence(const string& val)
+{
+  string::size_type old = x_precedence.size();
+  x_precedence = val;
+  return (old);
+}
+
+string::size_type
 SpamAssassin::set_spam_prev_content_type(const string& val)
 {
   string::size_type old = x_spam_prev_content_type.size();
diff -u spamass-milter-0.3.1/spamass-milter.h spamass-milter-0.3.1-precedence/spamass-milter.h
--- spamass-milter-0.3.1/spamass-milter.h	2007-08-22 06:14:58.000000000 +0200
+++ spamass-milter-0.3.1-precedence/spamass-milter.h	2008-12-27 15:13:08.000000000 +0100
@@ -99,6 +99,7 @@
   string& spam_checker_version();
   string& spam_level();
   string& content_type();
+  string& precedence();
   string& subject();
   string& rcpt();		/* first RCPT TO: recipient (raw) */
   string& from();		/* MAIL FROM: sender (raw) */
@@ -115,6 +116,7 @@
   string::size_type set_spam_checker_version(const string&);
   string::size_type set_spam_level(const string&);
   string::size_type set_content_type(const string&);
+  string::size_type set_precedence(const string&);
   string::size_type set_subject(const string&);
   string::size_type set_rcpt(const string&);
   string::size_type set_from(const string&);
@@ -138,7 +140,7 @@
   string outputbuffer;
 
   // Variables for SpamAssassin influenced fields
-  string x_spam_status, x_spam_flag, x_spam_report, x_spam_prev_content_type;
+  string x_spam_status, x_spam_flag, x_spam_report, x_spam_prev_content_type, x_precedence;
   string x_spam_checker_version, x_spam_level, _content_type, _subject;
   
   // Envelope info: MAIL FROM:, RCPT TO:, and IP address of remote host
[signature.asc (application/pgp-signature, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Don Armstrong <don@debian.org>:
Bug#509901; Package spamass-milter. (Mon, 29 Dec 2008 18:33:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jeroen Massar <jeroen@unfix.org>:
Extra info received and forwarded to list. Copy sent to Don Armstrong <don@debian.org>. (Mon, 29 Dec 2008 18:33:07 GMT) Full text and rfc822 format available.

Message #10 received at 509901@bugs.debian.org (full text, mbox):

From: Jeroen Massar <jeroen@unfix.org>
To: 509901@bugs.debian.org
Subject: Also filed to upstream (https://savannah.nongnu.org/support/?106593)
Date: Mon, 29 Dec 2008 19:30:26 +0100
[Message part 1 (text/plain, inline)]
I've also filed it to https://savannah.nongnu.org/support/?106593
in the hope that upstream also applies it directly.

Greets,
 Jeroen

[signature.asc (application/pgp-signature, attachment)]

Noted your statement that Bug has been forwarded to https://savannah.nongnu.org/support/?106593. Request was from Don Armstrong <don@debian.org> to control@bugs.debian.org. (Mon, 29 Dec 2008 21:33:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Don Armstrong <don@debian.org>:
Bug#509901; Package spamass-milter. (Fri, 22 May 2009 16:18:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin f krafft <madduck@debian.org>:
Extra info received and forwarded to list. Copy sent to Don Armstrong <don@debian.org>. (Fri, 22 May 2009 16:18:07 GMT) Full text and rfc822 format available.

Message #17 received at 509901@bugs.debian.org (full text, mbox):

From: martin f krafft <madduck@debian.org>
To: 509901@bugs.debian.org
Subject: good idea, also for clamav-milter!
Date: Fri, 22 May 2009 18:13:57 +0200
[Message part 1 (text/plain, inline)]
severity 509901 wishlist
tags 509901 patch
retitle 509901 turn REJECT into DISCARD when "Precedence: (list|junk|bulk) header present
clone 509901 -1
reassign -1 clamav-milter
retitle -1 turn REJECT into BLACKHOLE when "Precedence: (list|junk|bulk) header present
tags -1 -patch
thanks

This is a good idea, I think, and also applies to clamav-milter.

+1 from me.

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
[digital_signature_gpg.asc (application/pgp-signature, inline)]

Severity set to `wishlist' from `normal' Request was from martin f krafft <madduck@debian.org> to control@bugs.debian.org. (Fri, 22 May 2009 16:18:14 GMT) Full text and rfc822 format available.

Tags added: patch Request was from martin f krafft <madduck@debian.org> to control@bugs.debian.org. (Fri, 22 May 2009 16:18:15 GMT) Full text and rfc822 format available.

Changed Bug title to `turn REJECT into DISCARD when "Precedence: (list|junk|bulk) header present' from `Patch for spamass-milter to make a REJECT with "Precedence: List" into a DISCARD - Solves Debian List Spam Forwarding issue to people who do do spam checking'. Request was from martin f krafft <madduck@debian.org> to control@bugs.debian.org. (Fri, 22 May 2009 16:18:16 GMT) Full text and rfc822 format available.

Bug 509901 cloned as bug 529986. Request was from martin f krafft <madduck@debian.org> to control@bugs.debian.org. (Fri, 22 May 2009 16:18:16 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Don Armstrong <don@debian.org>:
Bug#509901; Package spamass-milter. (Sat, 23 May 2009 09:18:16 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin f krafft <madduck@debian.org>:
Extra info received and forwarded to list. Copy sent to Don Armstrong <don@debian.org>. (Sat, 23 May 2009 09:18:16 GMT) Full text and rfc822 format available.

Message #30 received at 509901@bugs.debian.org (full text, mbox):

From: martin f krafft <madduck@debian.org>
To: Jeroen Massar <jeroen@unfix.org>, 509901@bugs.debian.org
Subject: Re: Bug#509901: Patch for spamass-milter to make a REJECT with "Precedence: List" into a DISCARD - Solves Debian List Spam Forwarding issue to people who do do spam checking
Date: Sat, 23 May 2009 11:08:46 +0200
[Message part 1 (text/plain, inline)]
also sprach Jeroen Massar <jeroen@unfix.org> [2008.12.27.1633 +0100]:
> +		// Change Reject into a DISCARD when the Precedence is List
> +		// This stops us from bouncing towards mailing lists
> +		// See bottom of http://lists.debian.org/debian-project/2008/12/msg00151.html
> +		// Added by Jeroen Massar
> +		if (cmp_nocase_partial("List", assassin->precedence()) == 0) do_reject = false;

This should probably be repeated for Bulk and Junk.

> +		if (do_reject)
> +		{
> +			debug(D_MISC, "Rejecting");
> +			smfi_setreply(ctx, "550", "5.7.1", "Blocked by SpamAssassin");
> +		}
> +		else
> +		{
> +			debug(D_MISC, "Discarding");
> +			/* No reply here, we just throw it out of the door */
> +		}

It would be good to have some verbose logging, so that I can look at
verbose or debug logs and figure out why a message was discarded and
not rejected.

-- 
 .''`.   martin f. krafft <madduck@d.o>      Related projects:
: :'  :  proud Debian developer               http://debiansystem.info
`. `'`   http://people.debian.org/~madduck    http://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems
[digital_signature_gpg.asc (application/pgp-signature, inline)]

Changed Bug title to `turn REJECT into DISCARD when Precedence: (list|junk|bulk) header present' from `turn REJECT into DISCARD when "Precedence: (list|junk|bulk) header present'. Request was from martin f. krafft <madduck@debian.org> to control@bugs.debian.org. (Sat, 23 May 2009 09:18:25 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Mon Apr 21 02:29:03 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.