naughty: support reject_type set by original plugin

that marked the connection as naughty
This commit is contained in:
Matt Simerson 2012-06-23 00:46:39 -04:00
parent 6c2b65d3af
commit 183d8b9f18

View File

@ -88,7 +88,8 @@ from detecting address validity.
=head2 reject_type [ temp | perm | disconnect ]
What type of rejection should be sent? See docs/config.pod
If the plugin that set naughty didn't specify, what type of rejection should
be sent? See docs/config.pod
=head2 loglevel
@ -99,7 +100,7 @@ Adjust the quantity of logging for this plugin. See docs/logging.pod
Here's how to use naughty and get_reject in your plugin:
sub register {
my ($self,$qp) = shift, shift;
my ($self, $qp) = (shift, shift);
$self->{_args} = { @_ };
$self->{_args}{reject} ||= 'naughty';
};
@ -123,7 +124,7 @@ use warnings;
use Qpsmtpd::Constants;
sub register {
my ($self, $qp ) = shift, shift;
my ($self, $qp) = (shift, shift);
$self->log(LOGERROR, "Bad arguments") if @_ % 2;
$self->{_args} = { @_ };
$self->{_args}{reject} ||= 'rcpt';
@ -156,6 +157,8 @@ sub naughty {
return DECLINED;
};
$self->log(LOGINFO, "disconnecting");
return ( $self->get_reject_type(), $naughty );
my $type = $self->get_reject_type( 'disconnect',
$self->connection->notes('naughty_reject_type') );
return ( $type, $naughty );
};