add deny hook (Rasjid Wilcox)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@111 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
parent
bcaf58471e
commit
5eec66f3e2
@ -123,3 +123,12 @@ Called just before we shutdown a connection.
|
||||
The return code is ignored. If a plugin returns anything but DECLINED
|
||||
the following plugins will not be run (like with all other hooks).
|
||||
|
||||
=head2 deny
|
||||
|
||||
Called when another hook returns DENY or DENYSOFT. First parameter is
|
||||
the previous hook return code; the second parameter the message the
|
||||
hook returned.
|
||||
|
||||
Returning DONE or OK will stop the next deny hook from being run.
|
||||
DECLINED will make qpsmtpd run the remaining configured deny hooks.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package Qpsmtpd;
|
||||
use strict;
|
||||
|
||||
$Qpsmtpd::VERSION = "0.20";
|
||||
$Qpsmtpd::VERSION = "0.21-dev";
|
||||
sub TRACE_LEVEL { 6 }
|
||||
|
||||
use Sys::Hostname;
|
||||
@ -146,6 +146,14 @@ sub run_hooks {
|
||||
and $self->log(1, "plugin ".$code->{name}
|
||||
."running the $hook hook returned undef!")
|
||||
and next;
|
||||
|
||||
# should we have a hook for "OK" too?
|
||||
if ($r[0] == DENY or $r[0] == DENYSOFT) {
|
||||
$r[1] = "" if not defined $r[1];
|
||||
$self->log(10, "Plugin $code->{name}, hook $hook returned $r[0], $r[1]");
|
||||
$self->run_hooks("deny", $code->{name}, $r[0], $r[1]) unless ($hook eq "deny");
|
||||
}
|
||||
|
||||
last unless $r[0] == DECLINED;
|
||||
}
|
||||
$r[0] = DECLINED if not defined $r[0];
|
||||
|
Loading…
Reference in New Issue
Block a user