From 3a016b1da8b0fec34b2bca7b24ce4d26e22e5a3b Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Sat, 2 Jun 2012 14:46:29 -0400 Subject: [PATCH] Plugin.pm: added is_immune --- lib/Qpsmtpd/Plugin.pm | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/Qpsmtpd/Plugin.pm b/lib/Qpsmtpd/Plugin.pm index d56a289..8ab8baf 100644 --- a/lib/Qpsmtpd/Plugin.pm +++ b/lib/Qpsmtpd/Plugin.pm @@ -210,6 +210,37 @@ sub compile { die "eval $@" if $@; } +sub is_immune { + my $self = shift; + + if ( $self->qp->connection->relay_client() ) { + # set by plugins/relay, or Qpsmtpd::Auth + $self->log(LOGINFO, "skip, relay client"); + return 1; + }; + if ( $self->qp->connection->notes('whitelisthost') ) { + # set by plugins/dns_whitelist_soft or plugins/whitelist + $self->log(LOGINFO, "skip, whitelisted host"); + return 1; + }; + if ( $self->qp->transaction->notes('whitelistsender') ) { + # set by plugins/whitelist + $self->log(LOGINFO, "skip, whitelisted sender"); + return 1; + }; + if ( $self->connection->notes('zombie') ) { + # see plugins/reaper + $self->log(LOGINFO, "skip, zombie"); + return 1; + }; + if ( $self->connection->notes('rejected') ) { + # http://www.steve.org.uk/Software/ms-lite/ + $self->log(LOGINFO, "skip, already rejected"); + return 1; + }; + return; +}; + sub _register_standard_hooks { my ($plugin, $qp) = @_;