amavisd-2.6-recipient-policybank.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --- a/amavisd.orig 2008-06-12 12:28:13.000000000 +0200
  2. +++ b/amavisd-new-2.6 2008-06-12 12:36:52.000000000 +0200
  3. @@ -338,7 +338,8 @@
  4. %hdrfrom_notify_release_by_ccat %hdrfrom_notify_report_by_ccat
  5. %admin_maps_by_ccat %warnrecip_maps_by_ccat
  6. %always_bcc_by_ccat %dsn_bcc_by_ccat
  7. - %addr_extension_maps_by_ccat %addr_rewrite_maps_by_ccat
  8. + %addr_extension_maps_by_ccat %addr_rewrite_maps_by_ccat
  9. + %recipient_policy_bank_map %recipient_policy_bank_re_map
  10. )],
  11. 'confvars' => # global settings (not per-policy, not per-recipient)
  12. [qw(
  13. @@ -372,6 +373,7 @@
  14. %banned_rules $penpals_threshold_low $penpals_threshold_high
  15. $enable_dkim_verification $enable_dkim_signing %dkim_signing_keys
  16. $file $altermime $enable_anomy_sanitizer
  17. + %recipient_policy_bank_map %recipient_policy_bank_re_map
  18. )],
  19. 'sa' => # global SpamAssassin settings
  20. [qw(
  21. @@ -15481,6 +15483,26 @@
  22. $recip_obj->dsn_orcpt($orcpt) if defined $orcpt;
  23. push(@recips,$recip_obj);
  24. $msg = "250 2.1.5 Recipient $addr OK";
  25. + my ($user, $domain) = split('@', $addr);
  26. + if (defined $recipient_policy_bank_map{$addr}) {
  27. + Amavis::load_policy_bank($recipient_policy_bank_map{$addr});
  28. + do_log(1, sprintf("Policy bank '%s' taken for recp '%s'",
  29. + $recipient_policy_bank_map{$addr},
  30. + $addr));
  31. + } elsif (defined $recipient_policy_bank_map{$domain}) {
  32. + Amavis::load_policy_bank($recipient_policy_bank_map{$domain});
  33. + do_log(1, sprintf("Policy bank '%s' taken for recp '%s'",
  34. + $recipient_policy_bank_map{$domain},
  35. + $addr));
  36. + }
  37. + foreach my $recipient_re (keys(%recipient_policy_bank_re_map)) {
  38. + if ($addr =~ /$recipient_re/) {
  39. + Amavis::load_policy_bank($recipient_policy_bank_re_map{$recipient_re});
  40. + do_log(1, sprintf("Policy bank '%s' taken for recp '%s'",
  41. + $recipient_policy_bank_re_map{$domain},
  42. + $addr));
  43. + }
  44. + }
  45. }
  46. $self->smtp_resp(0,$msg, !$msg_nopenalize && $msg=~/^5/ ? 1 : 0, $cmd);
  47. last;