This commit is contained in:
the-djmaze 2023-12-03 12:58:54 +01:00
parent 57c000908f
commit b5552c1408
2 changed files with 5 additions and 3 deletions

View file

@ -131,6 +131,9 @@ class ImapClient extends \MailSo\Net\NetClient
}
$type = '';
if ($this->Encrypted()) {
\array_unshift($oSettings->SASLMechanisms, 'PLAIN', 'LOGIN');
}
foreach ($oSettings->SASLMechanisms as $sasl_type) {
if ($this->hasCapability("AUTH={$sasl_type}") && \SnappyMail\SASL::isSupported($sasl_type)) {
$type = $sasl_type;
@ -159,8 +162,7 @@ class ImapClient extends \MailSo\Net\NetClient
{
if (\str_starts_with($type, 'SCRAM-'))
{
$sAuthzid = $this->getResponseValue($this->SendRequestGetResponse('AUTHENTICATE', array($type)), Enumerations\ResponseType::CONTINUATION);
$this->sendRaw($SASL->authenticate($sLogin, $sPassword/*, $sAuthzid*/), true);
$this->sendRaw($this->SendRequestGetResponse('AUTHENTICATE', array($type, $SASL->authenticate($sLogin, $sPassword))));
$sChallenge = $SASL->challenge($this->getResponseValue($this->getResponse(), Enumerations\ResponseType::CONTINUATION));
$this->logMask($sChallenge);
$this->sendRaw($sChallenge);

View file

@ -72,7 +72,7 @@ class ConnectSettings implements \JsonSerializable
}
$object->shortLogin = !empty($aSettings['shortLogin']);
$object->ssl = SSLContext::fromArray($aSettings['ssl'] ?? []);
if (isset($aSettings['sasl'])) {
if (!empty($aSettings['sasl']) && \is_array($aSettings['sasl'])) {
$object->SASLMechanisms = $aSettings['sasl'];
}
// $object->tls_weak = !empty($aSettings['tls_weak']);