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).

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@612 958fd67b-6ff1-0310-b445-bb7760255be9
This commit is contained in:
John Peacock 2006-02-07 02:03:00 +00:00
parent 16b2a9c766
commit 6f145149ae

View File

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