Better fix for #780

This commit is contained in:
the-djmaze 2022-12-16 11:45:24 +01:00
parent edd083801f
commit 3fdb2e7698

View file

@ -119,7 +119,7 @@ class ImapClient extends \MailSo\Net\NetClient
$this->sLogginedUser = $sLogin; $this->sLogginedUser = $sLogin;
$type = 'LOGIN'; $type = '';
foreach ($oSettings->SASLMechanisms as $sasl_type) { foreach ($oSettings->SASLMechanisms as $sasl_type) {
if ($this->IsSupported("AUTH={$sasl_type}") && \SnappyMail\SASL::isSupported($sasl_type)) { if ($this->IsSupported("AUTH={$sasl_type}") && \SnappyMail\SASL::isSupported($sasl_type)) {
$type = $sasl_type; $type = $sasl_type;
@ -127,8 +127,8 @@ class ImapClient extends \MailSo\Net\NetClient
} }
} }
// RFC3501 6.2.3 // RFC3501 6.2.3
if ('LOGIN' === $type && $this->IsSupported('LOGINDISABLED')) { if (!$type && \in_array('LOGIN', $oSettings->SASLMechanisms) && !$this->IsSupported('LOGINDISABLED')) {
$type = ''; $type = 'LOGIN';
} }
if (!$type) { if (!$type) {
if (!$this->Encrypted() && $this->IsSupported('STARTTLS')) { if (!$this->Encrypted() && $this->IsSupported('STARTTLS')) {