[svn:qpsmtpd] r612 - branches/0.3x/lib/Qpsmtpd

[email protected] 7 Feb 2006 02:03:00 -0000
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
Author: jpeacock
Date: Mon Feb  6 18:03:00 2006
New Revision: 612

Modified:
   branches/0.3x/lib/Qpsmtpd/Auth.pm
Log:
Apparently, I never tested TLS and AUTH at the same time.  It turns out
that you have to explicitely read from <STDIN> in order for IO::Socket::SSL
to correctly translate the data (i.e. reading from <> isn't sufficient).

Modified: branches/0.3x/lib/Qpsmtpd/Auth.pm
==============================================================================
--- branches/0.3x/lib/Qpsmtpd/Auth.pm	(original)
+++ branches/0.3x/lib/Qpsmtpd/Auth.pm	Mon Feb  6 18:03:00 2006
@@ -236,7 +236,7 @@ sub SASL {
     if ( $mechanism eq "plain" ) {
         if (!$prekey) {
           $session->respond( 334, "Please continue" );
-          $prekey= <>;
+          $prekey= <STDIN>;
         }
         ( $passHash, $user, $passClear ) = split /\x0/,
           decode_base64($prekey);
@@ -250,7 +250,7 @@ sub SASL {
         else {
     
           $session->respond(334, e64("Username:"));
-          $user = decode_base64(<>);
+          $user = decode_base64(<STDIN>);
           #warn("Debug: User: '$user'");
           if ($user eq '*') {
             $session->respond(501, "Authentification canceled");
@@ -258,7 +258,7 @@ sub SASL {
           }
     
           $session->respond(334, e64("Password:"));
-          $passClear = <>;
+          $passClear = <STDIN>;
           $passClear = decode_base64($passClear);
           #warn("Debug: Pass: '$pass'");
           if ($passClear eq '*') {
@@ -277,9 +277,7 @@ sub SASL {
 
         # We send the ticket encoded in Base64
         $session->respond( 334, encode_base64( $ticket, "" ) );
-        my $line = <>;
-        chop($line);
-        chop($line);
+        my $line = <STDIN>;
 
         if ( $line eq '*' ) {
             $session->respond( 501, "Authentification canceled" );
@@ -287,7 +285,6 @@ sub SASL {
         }
 
         ( $user, $passHash ) = split( ' ', decode_base64($line) );
-
     }
     else {
         $session->respond( 500, "Unrecognized authentification mechanism" );