View | Details | Raw Unified | Return to bug 7354
Collapse All | Expand All

(-)lib/Mail/SpamAssassin/Conf.pm (+55 lines)
Lines 757-762 Link Here
757
    }
757
    }
758
  });
758
  });
759
759
760
=item enlist_addrlist (listname) user@example.com
761
762
Adds one or more addresses to a named list of addresses.
763
The named list can then be consulted through a check_from_in_list() or a 
764
check_to_in_list() eval rule implemented by the WLBLEval plugin, which takes 
765
the list name as an argument. Parenthesis around a list name are literal - a 
766
required syntax.
767
768
Listed addresses are file-glob-style patterns, so C<friend@somewhere.com>, 
769
C<*@isp.com>, or C<*.domain.net> will all work.
770
Specifically, C<*> and C<?> are allowed, but all other metacharacters
771
are not. Regular expressions are not used for security reasons.
772
Matching is case-insensitive.
773
774
Multiple addresses per line, separated by spaces, is OK.  Multiple
775
C<enlist_addrlist> lines are also OK.
776
777
Use the remove_addrlist directive to neutralize previous enlist_addrlist
778
settings.
779
780
Enlisting an address to the list named blacklist_to is synonymous to using the
781
directive blacklist_to 
782
783
Enlisting an address to the list named blacklist_from is synonymous to using the
784
directive blacklist_from
785
786
Enlisting an address to the list named whitelist_to is synonymous to using the
787
directive whitelist_to 
788
789
Enlisting an address to the list named whitelist_from is synonymous to using the
790
directive whitelist_from
791
792
e.g.
793
794
  enlist_addrlist (PAYPAL_ADDRESS) service@paypal.com
795
  enlist_addrlist (PAYPAL_ADDRESS) *@paypal.co.uk
796
797
=cut
798
799
  push (@cmds, {
800
    setting => 'enlist_addrlist',
801
    type => $CONF_TYPE_ADDRLIST,
802
    code => sub {
803
      my($conf, $key, $value, $line) = @_;
804
      local($1,$2);
805
      if ($value !~ /^ \( (.*?) \) \s+ (.*) \z/sx) {
806
        return $MISSING_REQUIRED_VALUE;
807
      }
808
      my $listname = $1;  # corresponds to arg in check_uri_host_in_wblist()
809
      # note: must not factor out dereferencing, as otherwise
810
      # subhashes would spring up in a copy and be lost
811
      $conf->{parser}->add_to_addrlist ($listname, split(/\s+/, $value));
812
    }
813
  });
814
760
=item blacklist_uri_host host-or-domain ...
815
=item blacklist_uri_host host-or-domain ...
761
816
762
Is a shorthand for a directive:  enlist_uri_host (BLACK) host ...
817
Is a shorthand for a directive:  enlist_uri_host (BLACK) host ...
(-)lib/Mail/SpamAssassin/Plugin/WLBLEval.pm (+19 lines)
Lines 47-52 Link Here
47
  $self->register_eval_rule("check_to_in_more_spam");
47
  $self->register_eval_rule("check_to_in_more_spam");
48
  $self->register_eval_rule("check_to_in_all_spam");
48
  $self->register_eval_rule("check_to_in_all_spam");
49
  $self->register_eval_rule("check_from_in_list");
49
  $self->register_eval_rule("check_from_in_list");
50
  $self->register_eval_rule("check_replyto_in_list");
50
  $self->register_eval_rule("check_to_in_list");
51
  $self->register_eval_rule("check_to_in_list");
51
  $self->register_eval_rule("check_from_in_whitelist");
52
  $self->register_eval_rule("check_from_in_whitelist");
52
  $self->register_eval_rule("check_forged_in_whitelist");
53
  $self->register_eval_rule("check_forged_in_whitelist");
Lines 124-129 Link Here
124
  return 0;
125
  return 0;
125
}
126
}
126
127
128
sub check_replyto_in_list {
129
  my ($self, $pms, $list) = @_;
130
  my $list_ref = $self->{main}{conf}{$list};
131
  unless (defined $list_ref) {
132
    warn "eval: could not find list $list";
133
    return;
134
  }
135
136
  my $replyto = $pms->get("Reply-To:addr");
137
  return 0  if $replyto eq '';
138
139
  if ($self->_check_whitelist ($list_ref, $replyto)) {
140
    return 1;
141
  }
142
143
  return 0;
144
}
145
127
# TODO: this should be moved to a utility module off PerMsgStatus,
146
# TODO: this should be moved to a utility module off PerMsgStatus,
128
# rather than a plugin API; it's used in Bayes.pm as a utility
147
# rather than a plugin API; it's used in Bayes.pm as a utility
129
sub check_wb_list {
148
sub check_wb_list {

Return to bug 7354