NAME
Mail::SpamAssassin::Spamd
SYNOPSIS
use base qw(Mail::SpamAssassin::Spamd);
sub ... { ... }
...
DESCRIPTION
This module contains a skeleton for handling client request in spamd implementation. Must not be used directly, but subclassed.
An instance should have lifetime of a single request.
Interface is likely to change.
See the source code of spamd(1) and Mail::SpamAssassin::Spamd::Apache2(3).
AUTHORS
The SpamAssassin(tm) Project <https://spamassassin.apache.org/>
COPYRIGHT
SpamAssassin is distributed under the Apache License, Version 2.0, as described in the file LICENSE included with the distribution.
METHODS
log_connection()-
Call as soon as the connection is accepted.
log_start_work()-
Call after
parse_msgids(). log_end_work()-
Call after
pass_through_sa(). log_result()-
Call as late as possible, after sending response to the client.
check_headers()-
Sanity checks on headers sent by the client. Sends status line indicating error to the client and returns false on first problem found.
parse_msgids()-
Extract the Message-Id(s) for logging purposes.
protocol_error('error message')service_timeout('error message')-
Send appropriate status line to the client and log the error.
send_status_line('EX_FOO', 'message')-
EX_error constant defaults to
EX_OK. Message defaults to the name of the constant. send_response()-
Generates response (headers and body, no status line) to the request and sends it to the client.
pass_through_sa()-
Runs the actual tests. Wrap it with
eval()to implement timeout. spamhdr()-
Generates the
Spam: status ; score / thresholdresponse header. read_user_config()-
Read config for the current user and register a cleanup handler to restore state of the SA object later. This is a wrapper around the handle_user_* methods.
handle_user_sql('username')-
load_scoreonly_sql for the given user. Do not call this directly.
handle_user_ldap()-
load_scoreonly_ldap for the given user. Do not call this directly.
status()-
Returns the Mail::SpamAssassin::PerMsgStatus object. Only valid after
pass_through_sa(). spamtest()-
Returns the Mail::SpamAssassin object.
access_info()user()-
Returns username as supplied by client in the User header or string '(unknown)'. Use for logging purposes.
cfg()-
Returns Mail::SpamAssassin::Spamd::Config object (or hash reference with resembling values).
headers_in()-
Hash ref containing headers sent by the client.
cleanup_register(sub { ... }, $argument)-
APR::Pool functionality -- call a piece of code when the object is destroyed.
The following methods must be overloaded:
_remote_host()_remote_ip()_remote_port()-
Information about the client.
new( spamtest => $sa_object, foo => 'bar', ... )-
Creates new object;
shift && bless { @_ }, basically. handle_user_local('username')-
read_scoreonly_config for the given user. You might want to change uid, chdir, set $ENV, etc. Do not call this directly.
read_body()-
Read body from the client, run $self->spamtest->parse and store result as the
parsedkey. read_headers()-
Read method and headers from the client. Set various properties accordingly.
send_buffer('list of', 'buffers to send')-
Send buffers to the client.
auth_ident()-
XXX