summaryrefslogtreecommitdiff
blob: f959bb0678a8e88f16c71c0296b0add451b06700 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- qpsmtpd-0.40/lib/Qpsmtpd/SMTP.pm.peer_hooks	2007-06-14 11:57:27.000000000 -0600
+++ qpsmtpd-0.40/lib/Qpsmtpd/SMTP.pm	2007-06-14 13:44:52.000000000 -0600
@@ -95,6 +95,11 @@
     my $self = shift;
     # 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;
 }
@@ -278,7 +283,9 @@
 
     # if we don't have a plugin implementing this auth mechanism, 504
     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};
     } else {
       $self->respond( 504, "Unimplemented authentification mechanism: $mechanism" );
       return DENY;
--- qpsmtpd-0.40/lib/Qpsmtpd//Plugin.pm.peer_hooks	2008-03-25 02:02:37.000000000 +0000
+++ qpsmtpd-0.40/lib/Qpsmtpd//Plugin.pm	2008-03-25 02:04:00.000000000 +0000
@@ -6,7 +6,7 @@
 our @hooks = qw(
     logging config 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_post queue_pre queue queue_post vrfy noop
     quit reset_transaction disconnect post-connection
     unrecognized_command deny ok received_line help