Permalink
Browse files

fixed occassional Auth error messages due to undefined $user

and fixed a typo
  • Loading branch information...
1 parent c61efc1 commit b4af0287e1a1913b966e7d4169906d31a486aebb @msimerson committed Apr 29, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/Qpsmtpd/Auth.pm
View
14 lib/Qpsmtpd/Auth.pm
@@ -26,10 +26,20 @@ sub SASL {
( $loginas, $user, $passClear ) = split /\x0/,
decode_base64($prekey);
+ if ( ! $user ) {
+ if ( $loginas ) {
+ $session->respond(535, "Authentication invalid ($loginas)");
+ }
+ else {
+ $session->respond(535, "Authentication invalid");
+ }
+ return DECLINED;
+ };
+
# Authorization ID must not be different from
# Authentication ID
if ( $loginas ne '' && $loginas ne $user ) {
- $session->respond(535, "Authentication invalid");
+ $session->respond(535, "Authentication invalid for $user");
return DECLINED;
}
}
@@ -59,7 +69,7 @@ sub SASL {
# rand() is not cryptographic, but we only need to generate a globally
# unique number. The rand() is there in case the user logs in more than
- # once in the same second, of if the clock is skewed.
+ # once in the same second, or if the clock is skewed.
$ticket = sprintf( '<%x.%x@%s>',
rand(1000000), time(), $session->config("me") );

0 comments on commit b4af028

Please sign in to comment.