Author: vetinari
Date: Sun Sep 30 06:00:32 2007
New Revision: 805

Modified:
   trunk/plugins/tls

Log:
plugins/tls: work-around for failed connections in -prefork after STARTTLS 
  connection (Stefan Priebe, Hanno Hecker)


Modified: trunk/plugins/tls
==============================================================================
--- trunk/plugins/tls   (original)
+++ trunk/plugins/tls   Sun Sep 30 06:00:32 2007
@@ -104,7 +104,10 @@
             }
         }
     }
-    
+
+    # work-around for failed connections in -prefork after STARTTLS connection:
+    $self->register_hook('post-connection', 'prefork_workaround')
+      if $qp->isa('Qpsmtpd::SMTP::Prefork');
 }
 
 sub hook_ehlo {
@@ -224,3 +227,14 @@
     return DECLINED;
 }
 *hook_helo = *hook_data = *hook_rcpt = *hook_mail = \&bad_ssl_hook;
+
+# work-around for failed connections in -prefork after STARTTLS connection:
+sub prefork_workaround {
+    my $self = shift;
+    # nothing to do on SSL only (SMTPS) and clear text communications
+    return (DECLINED) if     $self->connection->local_port == 465;
+    return (DECLINED) unless $self->connection->notes('tls_enabled');
+
+    $self->log(LOGWARN, "Exiting because 'tls_enabled' was true.");
+    exit;
+}

Reply via email to