qpsmtpd/qpsmtpd-0.96-set_hooks.patch

39 lines
1.9 KiB
Diff
Raw Normal View History

diff -Nur -x '*.orig' -x '*.rej' qpsmtpd-0.96/lib/Qpsmtpd/Plugin.pm mezzanine_patched_qpsmtpd-0.96/lib/Qpsmtpd/Plugin.pm
--- qpsmtpd-0.96/lib/Qpsmtpd/Plugin.pm 2016-02-16 23:52:02.000000000 +0100
+++ mezzanine_patched_qpsmtpd-0.96/lib/Qpsmtpd/Plugin.pm 2016-04-15 17:08:29.174840108 +0200
@@ -10,7 +10,7 @@
our @hooks = qw(
logging config user_config post-fork pre-connection connect ehlo_parse ehlo
helo_parse helo auth_parse auth auth-plain auth-login auth-cram-md5
- rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre
+ valid_auth set_hooks rcpt_parse rcpt_pre rcpt mail_parse mail mail_pre
data data_headers_end data_post_headers data_post queue_pre queue queue_post vrfy noop
quit reset_transaction disconnect post-connection
unrecognized_command deny ok received_line help
diff -Nur -x '*.orig' -x '*.rej' qpsmtpd-0.96/lib/Qpsmtpd/SMTP.pm mezzanine_patched_qpsmtpd-0.96/lib/Qpsmtpd/SMTP.pm
--- qpsmtpd-0.96/lib/Qpsmtpd/SMTP.pm 2016-04-15 17:08:57.630842467 +0200
+++ mezzanine_patched_qpsmtpd-0.96/lib/Qpsmtpd/SMTP.pm 2016-04-15 17:07:45.577836505 +0200
@@ -96,6 +96,11 @@
# this should maybe be called something else than "connect", see
# lib/Qpsmtpd/TcpServer.pm for more confusion.
+ my ($rc, $msg) = $self->run_hooks("set_hooks");
+ if ($rc == DENY) {
+ $self->respond(550, ($msg || 'Connection from you denied, bye bye.'));
+ return $rc;
+ }
$self->run_hooks("connect");
return DONE;
}
@@ -309,7 +314,9 @@
&& $self->transaction->notes('tls_enabled'));
if (exists $auth_mechanisms{uc($mechanism)}) {
- return $self->{_auth} = Qpsmtpd::Auth::SASL($self, $mechanism, @stuff);
+ $self->{_auth} = Qpsmtpd::Auth::SASL( $self, $mechanism, @stuff );
+ $self->run_hooks("valid_auth") if $self->{_auth} == OK;
+ return $self->{_auth};
}
# no plugin implementing this auth mechanism