[svn:qpsmtpd] r541 - trunk/plugins

[email protected] 15 Aug 2005 17:58:41 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: msergeant
Date: Mon Aug 15 10:58:41 2005
New Revision: 541

Modified:
   trunk/plugins/tls
Log:
Fix for tls enabling auth - this is kind of hacky, and I'd prefer to fix
this nastiness in the auth support instead. But this works for now.


Modified: trunk/plugins/tls
==============================================================================
--- trunk/plugins/tls	(original)
+++ trunk/plugins/tls	Mon Aug 15 10:58:41 2005
@@ -40,6 +40,21 @@ sub init {
     ) or die "Could not create SSL context: $!";
     
     $self->ssl_context($ssl_ctx);
+    
+    # Check for possible AUTH mechanisms
+HOOK: foreach my $hook ( keys %{$qp->{hooks}} ) {
+        if ( $hook =~ m/^auth-?(.+)?$/ ) {
+            if ( defined $1 ) {
+                my $hooksub = "hook_$hook";
+                $hooksub =~ s/\W/_/g;
+                *$hooksub = \&bad_ssl_hook;
+            }
+            else { # at least one polymorphous auth provider
+                *hook_auth = \&bad_ssl_hook;
+            }
+        }
+    }
+    
 }
 
 sub hook_ehlo {
@@ -143,4 +158,4 @@ sub bad_ssl_hook {
     return DENY, "Command refused due to lack of security" if $transaction->notes('ssl_failed');
     return DECLINED;
 }
-*hook_helo = *hook_data = *hook_rcpt = *hook_mail = *hook_auth = \&bad_ssl_hook;
+*hook_helo = *hook_data = *hook_rcpt = *hook_mail = \&bad_ssl_hook;