bogofilter 0.11.1.3: spam_subject_tag is always stamped in (regardless of actual spamicity)

David Relson relson at osagesoftware.com
Tue Mar 25 02:44:15 CET 2003


Christian,

You have, indeed, found a flaw in the printing of 
spam_subject_tag.   You're right that write_mssage() needs an "rc_t status" 
parameter.  However the code for including the spam_header_tag in the 
output can be simplified.  I've attached a patch that does the job (I think).

If you'd be so kind as to test it and let me know, I'be 
appreciative.  Given the "go ahead", I'll commit it to CVS and fix bogofilter.

David
-------------- next part --------------
Index: main.c
===================================================================
RCS file: /cvsroot/bogofilter/bogofilter/src/main.c,v
retrieving revision 1.18
diff -u -r1.18 main.c
--- main.c	11 Mar 2003 04:48:09 -0000	1.18
+++ main.c	25 Mar 2003 01:33:53 -0000
@@ -56,7 +56,7 @@
 /* Function Prototypes */
 
 static void write_log_message(void);
-static void write_message(FILE *fp);
+static void write_message(FILE *fp, rc_t status);
 
 /* Function Definitions */
 
@@ -123,7 +123,7 @@
 	double spamicity;
 	rc_t   status = bogofilter(&spamicity);
 
-	write_message(out);
+	write_message(out, status);
 
 	exitcode = (status == RC_SPAM) ? 0 : 1;
 	if (nonspam_exits_zero && passthrough && exitcode == 1)
@@ -203,7 +203,7 @@
 
 typedef int (*readfunc_t)(char **, void *);
 
-static void write_message(FILE *fp)
+static void write_message(FILE *fp, rc_t status)
 {
     ssize_t rd = 0;	/* assignment to quench warning */
     readfunc_t rf = 0;	/* assignment to quench warning */
@@ -245,7 +245,8 @@
 		continue;
 
 	    /* rewrite "Subject: " line */
-	    if (rd >= subjlen && 
+	    if (status == RC_SPAM &&
+		rd >= subjlen && 
 		spam_subject_tag != NULL &&
 		memcmp(out, "Subject:", subjlen) == 0) {
 		(void) fprintf(fp, "Subject: %s", spam_subject_tag);


More information about the bogofilter-dev mailing list