move 'use ParaDNS' into register and eval it
so eventually, plugin tests can run against it, if ParaDNS can be loaded
This commit is contained in:
parent
2f49cafcd6
commit
e8e47ad93b
@ -1,10 +1,15 @@
|
||||
#!perl -w
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Qpsmtpd::Constants;
|
||||
use Qpsmtpd::DSN;
|
||||
use ParaDNS;
|
||||
use Socket;
|
||||
use Qpsmtpd::TcpServer;
|
||||
|
||||
#use ParaDNS; # moved into register
|
||||
use Socket;
|
||||
|
||||
my %invalid = ();
|
||||
my $has_ipv6 = Qpsmtpd::TcpServer::has_ipv6();
|
||||
|
||||
@ -19,6 +24,11 @@ sub register {
|
||||
}
|
||||
}
|
||||
|
||||
eval 'use ParaDNS';
|
||||
if ( $@ ) {
|
||||
warn "could not load ParaDNS, plugin disabled";
|
||||
return DECLINED;
|
||||
};
|
||||
$self->register_hook( mail => 'hook_mail_start' );
|
||||
$self->register_hook( mail => 'hook_mail_done' );
|
||||
}
|
||||
@ -26,11 +36,10 @@ sub register {
|
||||
sub hook_mail_start {
|
||||
my ( $self, $transaction, $sender ) = @_;
|
||||
|
||||
return DECLINED
|
||||
if ( $self->qp->connection->notes('whitelisthost') );
|
||||
return DECLINED if $self->qp->connection->notes('whitelisthost');
|
||||
|
||||
if ( $sender ne '<>' ) {
|
||||
|
||||
if ( $sender ne "<>" ) {
|
||||
|
||||
unless ( $sender->host ) {
|
||||
# default of addr_bad_from_system is DENY, we use DENYSOFT here to
|
||||
# get the same behaviour as without Qpsmtpd::DSN...
|
||||
@ -47,7 +56,7 @@ sub hook_mail_start {
|
||||
|
||||
return YIELD;
|
||||
}
|
||||
|
||||
|
||||
return DECLINED;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user