diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/sasl/login.php b/snappymail/v/0.0.0/app/libraries/snappymail/sasl/login.php index 9dcbd446d..52608a49f 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/sasl/login.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/sasl/login.php @@ -11,9 +11,8 @@ class Login extends \SnappyMail\SASL { // $challenge should be 'VXNlcm5hbWU6', but broken on some systems // See https://github.com/the-djmaze/snappymail/issues/693 - if ($challenge && \str_starts_with($this->decode($challenge), 'Username:')) { -// if ($challenge && 'Username:' !== $this->decode($challenge)) { - throw new \Exception("Invalid response: {$challenge}"); + if ($challenge && !\str_starts_with($this->decode($challenge), 'Username:')) { + throw new \Exception("Invalid response: {$this->decode($challenge)}"); } $this->passphrase = $passphrase; return $this->encode($username); diff --git a/test/sasl.php b/test/sasl.php new file mode 100644 index 000000000..f36d238e4 --- /dev/null +++ b/test/sasl.php @@ -0,0 +1,25 @@ +base64 = true; +var_dump($LOGIN->authenticate('john', 'doe', 'VXNlcm5hbWU6')); +var_dump($LOGIN->authenticate('john', 'doe', 'VXNlcm5hbWU6CG')); +var_dump($LOGIN->authenticate('john', 'doe', 'UGFzc3dvcmQ6'));