Author: vetinari
Date: Mon May 12 07:42:41 2008
New Revision: 900
Modified:
trunk/lib/Qpsmtpd/PollServer.pm
Log:
async: check return values from pre-connection hook
Modified: trunk/lib/Qpsmtpd/PollServer.pm
==============================================================================
--- trunk/lib/Qpsmtpd/PollServer.pm (original)
+++ trunk/lib/Qpsmtpd/PollServer.pm Mon May 12 07:42:41 2008
@@ -55,7 +55,21 @@
$self->{mode} = 'connect';
$self->load_plugins;
$self->load_logging;
- $self->run_hooks("pre-connection");
+
+ my ($rc, @msg) = $self->run_hooks("pre-connection");
+ if ($rc == DENYSOFT || $rc == DENYSOFT_DISCONNECT) {
+ @msg = ("Sorry, try again later")
+ unless @msg;
+ $self->respond(451, @msg);
+ $self->disconnect;
+ }
+ elsif ($rc == DENY || $rc == DENY_DISCONNECT) {
+ @msg = ("Sorry, service not available for you")
+ unless @msg;
+ $self->respond(550, @msg);
+ $self->disconnect;
+ }
+
return $self;
}