Bug 4644 - remove_header and SQL prefs serialization issue
Summary: remove_header and SQL prefs serialization issue
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: spamassassin (show other bugs)
Version: 3.1.0
Hardware: All All
: P3 minor
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
Depends on:
Reported: 2005-10-21 18:32 UTC by Dallas Engelken
Modified: 2005-10-21 10:32 UTC (History)
0 users

Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Dallas Engelken 2005-10-21 18:32:33 UTC
ok here we go...  report_safe 0 forces X-Spam-Report: to be added to the spam
headers via this code here in Conf.pm

      if (! $self->{report_safe}) {
        $self->{headers_spam}->{"Report"} = "_REPORT_";

Now, if I want to run report_safe 0 and remove the 'Report' header, the man says
to use 

remove_header all Report

So.. if I do this via local.cf, I use 

add_header all Level _STARS(*)_
add_header all Score _HITS_
add_header all Flag _YESNO_
remove_header all Report

That should do the trick!  Problem is, spamd is also using -q to pull SQL
prefs... and 'report_safe' is one of the sql prefs it reads.  As soon as
report_safe gets read via SQL and its set to 0,     
$self->{headers_spam}->{"Report"} gets re-added.

So, you'd think the fix would be to have a 'remove_header all Report' loaded via
SQL...  but, if your prefs are pulled alphabetically, remove_header <
report_safe, so report_safe gets applied after the sql pref remove_header.... 
catch 22.  

Since there is no way to prioritize SQL prefs currently, my suggestion is a
different way of handling remove_header prefs.  I think they should be stored in
an array in M::SA so they can then all be applied in one fell swoop in
M::SA::PMS.  The only other way around this would be prioritization of rules via
SQL, which i think would be alot more work.

here is a quick debug of the situation as M::SA::PMS reads a new message through
and the SQL prefs are pulled...

[5834] dbg: config: Conf::SQL: executing SQL: SELECT preference, value FROM
sa_rules WHERE username = 'user@domain.tld' OR username = '$GLOBAL' OR username
= CONCAT('%','domain.tld') ORDER BY username ASC
[5834] dbg: config: retrieving prefs for user@domain.tld from SQL server
[5834] dbg: Conf: remove_header delete ham header Report
[5834] dbg: Conf: remove_header delete spam header Report
[5834] dbg: Conf: report_safe is 0, adding X-Spam-Report header to headers_spam