This commit is contained in:
the-djmaze 2022-11-23 11:03:47 +01:00
parent 77ab2fddf5
commit 288e1c8742

View file

@ -9,7 +9,10 @@ class Login extends \SnappyMail\SASL
public function authenticate(string $username, string $passphrase, ?string $challenge = null) : string
{
if ($challenge && 'Username:' !== $this->decode($challenge)) {
// $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}");
}
$this->passphrase = $passphrase;
@ -18,6 +21,7 @@ class Login extends \SnappyMail\SASL
public function challenge(string $challenge) : ?string
{
// $challenge should be 'UGFzc3dvcmQ6'
if ($challenge && 'Password:' !== $this->decode($challenge)) {
throw new \Exception("invalid response: {$challenge}");
}