cvs commit: qpsmtpd/plugins spamassassin
[email protected] (Ask "Bj?rn" Hansen)
| Newsgroups | perl.cvs.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/03/05 01:12:21
Modified: . Changes
plugins spamassassin
Log:
spamd_socket support -- thanks to John Peacock
Revision Changes Path
1.61 +3 -0 qpsmtpd/Changes
Index: Changes
===================================================================
RCS file: /cvs/public/qpsmtpd/Changes,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -w -r1.60 -r1.61
--- Changes 4 Mar 2004 04:33:47 -0000 1.60
+++ Changes 5 Mar 2004 09:12:19 -0000 1.61
@@ -1,5 +1,8 @@
0.27
+ Support for unix sockets in the spamassassin plugin (requires SA
+ 2.60 or higher). Thanks to John Peacock!
+
Modified the dnsbl plugin to better support both A and TXT records and
support all of the RBLSMTPD functionality. (Thanks to Mark Powell)
1.7 +26 -3 qpsmtpd/plugins/spamassassin
Index: spamassassin
===================================================================
RCS file: /cvs/public/qpsmtpd/plugins/spamassassin,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- spamassassin 22 Feb 2004 02:17:29 -0000 1.6
+++ spamassassin 5 Mar 2004 09:12:20 -0000 1.7
@@ -44,12 +44,22 @@
The default is to never munge the subject based on the SpamAssassin score.
+=item spamd_socket [/path/to/socket]
+
+Beginning with Mail::SpamAssassin 2.60, it is possible to use Unix
+domain sockets for spamd. This is faster and more secure than using
+a TCP connection.
+
=back
-With both options the configuration line will look like the following
+With both of the first options the configuration line will look like the following
spamasssasin reject_threshold 18 munge_subject_threshold 8
+=head1 TODO
+
+Make the "subject munge string" configurable
+
=cut
@@ -88,8 +98,18 @@
my $paddr = sockaddr_in($port, $iaddr);
my $proto = getprotobyname('tcp');
+ if ( $self->{_args}->{spamd_socket} =~ /^([\w\/.]+)$/ ) { # connect to Unix Domain Socket
+ my $spamd_socket = $1;
+
+ socket(SPAMD, PF_UNIX, SOCK_STREAM, 0)
+ or $self->log(1, "Could not open socket: $!") and return (DECLINED);
+
+ $paddr = sockaddr_un($spamd_socket);
+ }
+ else {
socket(SPAMD, PF_INET, SOCK_STREAM, $proto)
or $self->log(1, "Could not open socket: $!") and return (DECLINED);
+ }
connect(SPAMD, $paddr)
or $self->log(1, "Could not connect to spamassassin daemon: $!") and return DECLINED;
@@ -101,6 +121,9 @@
print SPAMD "SYMBOLS SPAMC/1.0" . CRLF;
# or CHECK or REPORT or SYMBOLS
+
+ print SPAMD "X-Envelope-From: ", $transaction->sender->format, CRLF
+ or warn "Could not print to spamd: $!";
print SPAMD join CRLF, split /\n/, $transaction->header->as_string
or warn "Could not print to spamd: $!";