https://github.com/smtpd/qpsmtpd/pull/20

Prior to this change, many of the plugins had some form of immunity tests. Most 
of the implementations were partial (ie, they set immunity to for 1, 2, and 
sometimes 3 of the standard immunity tests (relay_client, whitelisthost, 
whitelistsender).  This set of changes consolidates the immunity testing into 
is_immune()  in Plugins.pm.  It also adds immunity for my zombies and Steve's 
rejected connections.

There may be cause to have is_immune accept arguments.  The example I kept 
watching for while updating the plugins is where a plugin might not want 
immunization against a certain test. But I didn't run into a case where that 
was desirable or necessary. 

Matt

PS: Here's the addition to Plugins.pm.

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;
};


`````````````````````````````````````````````````````````````````````````
  Matt Simerson                   http://matt.simerson.net/
  Systems Engineer            http://www.tnpi.net/

  Mail::Toaster  - http://mail-toaster.org/
  NicTool          - http://www.nictool.com/
`````````````````````````````````````````````````````````````````````````

Reply via email to