SA Bugzilla – Bug 2859
Add "Required-Hits:" to spamd communication protocol
Last modified: 2004-04-28 14:12:33 UTC
I have a custom written MDA that: 1) Queries a SQL server containing the domain / user configuration. 2) Connects to spamd for message processing. "spamd" doesn't need to be smart enough to pull the per domain / user config but I do need a way to pass the "required hits" threshold to "spamd" via the communication protocol. That's what this patch allows: *** spamd.orig Fri Dec 19 11:32:31 2003 --- spamd Fri Dec 19 15:15:42 2003 *************** *** 606,611 **** --- 606,612 ---- my ($method, $version, $start) = @_; local ($_); my $expected_length; + my $required_hits; # Protocol version 1.0 and greater may have "User:" and # "Content-length:" headers. But they're not required. *************** *** 657,662 **** --- 658,666 ---- if (/^Content-length: ([0-9]*)\r\n/i) { $expected_length = $1; } + if (/^Required-Hits: (\S*)\r\n/i) { + $required_hits = $1 + 0.00; + } } } *************** *** 719,724 **** --- 723,733 ---- if($expected_length && ($actual_length != $expected_length)) { protocol_error ("(Content-Length mismatch: Expected $expected_length bytes, got $actual_length bytes)"); return 1; + } + + # If connecting client specified required-hits then update the conf + if (defined($required_hits)) { + $spamtest->{conf}->{required_hits} = $required_hits; } # Now use copy-on-writed (hopefully) SA object
after discussion, we decided to close this ticket as "wontfix". the addition 1) doesn't have a general benefit to people, and 2) is a kluge (strong-arming the configuration is always a kluge...)