From 89f0e81194cc6cd579f709766a03cf3562bf9e3d Mon Sep 17 00:00:00 2001 From: djmaze Date: Fri, 22 Oct 2021 15:31:56 +0200 Subject: [PATCH] Sieve support login with OAUTHBEARER/XOAUTH2 --- .../app/libraries/MailSo/Sieve/ManageSieveClient.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php index 6b37bda61..3f9690c26 100644 --- a/snappymail/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php +++ b/snappymail/v/0.0.0/app/libraries/MailSo/Sieve/ManageSieveClient.php @@ -115,6 +115,8 @@ class ManageSieveClient extends \MailSo\Net\NetClient // 'SCRAM-SHA-256' => 1, // !$encrypted // 'SCRAM-SHA-1' => 1, // !$encrypted // 'CRAM-MD5' => 1, // $encrypted + 'OAUTHBEARER' => $aCredentials['UseAuthOAuth2IfSupported'], + 'XOAUTH2' => $aCredentials['UseAuthOAuth2IfSupported'], 'PLAIN' => 1, // $encrypted 'LOGIN' => 1 // $encrypted ]; @@ -131,17 +133,17 @@ class ManageSieveClient extends \MailSo\Net\NetClient $bAuth = false; try { - if ('PLAIN' === $type) + if ('PLAIN' === $type || 'OAUTHBEARER' === $type || 'XOAUTH2' === $type) { $sAuth = $SASL->authenticate($sLogin, $sPassword, $sLoginAuthKey); if ($aCredentials['InitialAuthPlain']) { - $this->sendRequest('AUTHENTICATE "PLAIN" "'.$sAuth.'"'); + $this->sendRequest("AUTHENTICATE \"{$type}\" \"{$sAuth}\""); } else { - $this->sendRequest('AUTHENTICATE "PLAIN" {'.\strlen($sAuth).'+}'); + $this->sendRequest("AUTHENTICATE \"{$type}\" {".\strlen($sAuth).'+}'); $this->sendRequest($sAuth); }