Index: lib/Mail/SpamAssassin/Conf.pm =================================================================== --- lib/Mail/SpamAssassin/Conf.pm (revision 1761574) +++ lib/Mail/SpamAssassin/Conf.pm (working copy) @@ -757,6 +757,61 @@ } }); +=item enlist_addrlist (listname) user@example.com + +Adds one or more addresses to a named list of addresses. +The named list can then be consulted through a check_from_in_list() or a +check_to_in_list() eval rule implemented by the WLBLEval plugin, which takes +the list name as an argument. Parenthesis around a list name are literal - a +required syntax. + +Listed addresses are file-glob-style patterns, so C, +C<*@isp.com>, or C<*.domain.net> will all work. +Specifically, C<*> and C are allowed, but all other metacharacters +are not. Regular expressions are not used for security reasons. +Matching is case-insensitive. + +Multiple addresses per line, separated by spaces, is OK. Multiple +C lines are also OK. + +Use the remove_addrlist directive to neutralize previous enlist_addrlist +settings. + +Enlisting an address to the list named blacklist_to is synonymous to using the +directive blacklist_to + +Enlisting an address to the list named blacklist_from is synonymous to using the +directive blacklist_from + +Enlisting an address to the list named whitelist_to is synonymous to using the +directive whitelist_to + +Enlisting an address to the list named whitelist_from is synonymous to using the +directive whitelist_from + +e.g. + + enlist_addrlist (PAYPAL_ADDRESS) service@paypal.com + enlist_addrlist (PAYPAL_ADDRESS) *@paypal.co.uk + +=cut + + push (@cmds, { + setting => 'enlist_addrlist', + type => $CONF_TYPE_ADDRLIST, + code => sub { + my($conf, $key, $value, $line) = @_; + local($1,$2); + if ($value !~ /^ \( (.*?) \) \s+ (.*) \z/sx) { + return $MISSING_REQUIRED_VALUE; + } + my $listname = $1; # corresponds to arg in check_uri_host_in_wblist() + # note: must not factor out dereferencing, as otherwise + # subhashes would spring up in a copy and be lost + $conf->{parser}->add_to_addrlist ($listname, split(/\s+/, $value)); + } + }); + =item blacklist_uri_host host-or-domain ... Is a shorthand for a directive: enlist_uri_host (BLACK) host ... Index: lib/Mail/SpamAssassin/Plugin/WLBLEval.pm =================================================================== --- lib/Mail/SpamAssassin/Plugin/WLBLEval.pm (revision 1761574) +++ lib/Mail/SpamAssassin/Plugin/WLBLEval.pm (working copy) @@ -47,6 +47,7 @@ $self->register_eval_rule("check_to_in_more_spam"); $self->register_eval_rule("check_to_in_all_spam"); $self->register_eval_rule("check_from_in_list"); + $self->register_eval_rule("check_replyto_in_list"); $self->register_eval_rule("check_to_in_list"); $self->register_eval_rule("check_from_in_whitelist"); $self->register_eval_rule("check_forged_in_whitelist"); @@ -124,6 +125,24 @@ return 0; } +sub check_replyto_in_list { + my ($self, $pms, $list) = @_; + my $list_ref = $self->{main}{conf}{$list}; + unless (defined $list_ref) { + warn "eval: could not find list $list"; + return; + } + + my $replyto = $pms->get("Reply-To:addr"); + return 0 if $replyto eq ''; + + if ($self->_check_whitelist ($list_ref, $replyto)) { + return 1; + } + + return 0; +} + # TODO: this should be moved to a utility module off PerMsgStatus, # rather than a plugin API; it's used in Bayes.pm as a utility sub check_wb_list {