logMask all AUTHENTICATE requests

This commit is contained in:
the-djmaze 2024-03-27 01:23:11 +01:00
parent f745a54669
commit b6df50546e
2 changed files with 13 additions and 4 deletions

View file

@ -164,6 +164,7 @@ class ImapClient extends \MailSo\Net\NetClient
$this->sendRaw($sAuth);
}
$oResponse = $this->getResponse();
// if ($oResponse->getLast()->ResponseType === Enumerations\ResponseType::CONTINUATION)
if ($SASL->hasChallenge()) {
$sChallenge = $SASL->challenge($this->getResponseValue($oResponse, Enumerations\ResponseType::CONTINUATION));
$this->logMask($sChallenge);
@ -192,7 +193,9 @@ class ImapClient extends \MailSo\Net\NetClient
{
$oResponse = $this->SendRequestGetResponse('AUTHENTICATE', array($type));
$sB64 = $this->getResponseValue($oResponse, Enumerations\ResponseType::CONTINUATION);
$this->sendRaw($SASL->authenticate($sLogin, $sPassword, $sB64), true);
$sAuth = $SASL->authenticate($sLogin, $sPassword, $sB64);
$this->logMask($sAuth);
$this->sendRaw($sAuth, true);
$this->getResponse();
$sPass = $SASL->challenge(''/*UGFzc3dvcmQ6*/);
$this->logMask($sPass);

View file

@ -153,7 +153,9 @@ class SmtpClient extends \MailSo\Net\NetClient
// https://github.com/the-djmaze/snappymail/issues/1038
try
{
$sResult = $this->sendRequestWithCheck('AUTH PLAIN ' . $SASL->authenticate($sLogin, $sPassword), 235);
$sRequest = $SASL->authenticate($sLogin, $sPassword);
$this->logMask($sRequest);
$sResult = $this->sendRequestWithCheck('AUTH PLAIN ' . $sRequest, 235);
}
catch (\MailSo\Smtp\Exceptions\NegativeResponseException $oException)
{
@ -179,7 +181,9 @@ class SmtpClient extends \MailSo\Net\NetClient
$sRequest = '';
if (\str_starts_with($type, 'SCRAM-')) {
// RFC 5802
$sResult = $this->sendRequestWithCheck($SASL->authenticate($sLogin, $sPassword, $sResult), 234);
$sRequest = $SASL->authenticate($sLogin, $sPassword, $sResult);
$this->logMask($sRequest);
$sResult = $this->sendRequestWithCheck($sRequest, 234);
$sRequest = $SASL->challenge($sResult);
} else switch ($type) {
// RFC 4616
@ -190,7 +194,9 @@ class SmtpClient extends \MailSo\Net\NetClient
break;
case 'LOGIN':
$sResult = $this->sendRequestWithCheck($SASL->authenticate($sLogin, $sPassword, $sResult), 334);
$sRequest = $SASL->authenticate($sLogin, $sPassword, $sResult);
$this->logMask($sRequest);
$sResult = $this->sendRequestWithCheck($sRequest, 334);
$sRequest = $SASL->challenge($sResult);
break;