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

View file

@ -153,7 +153,9 @@ class SmtpClient extends \MailSo\Net\NetClient
// https://github.com/the-djmaze/snappymail/issues/1038 // https://github.com/the-djmaze/snappymail/issues/1038
try 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) catch (\MailSo\Smtp\Exceptions\NegativeResponseException $oException)
{ {
@ -179,7 +181,9 @@ class SmtpClient extends \MailSo\Net\NetClient
$sRequest = ''; $sRequest = '';
if (\str_starts_with($type, 'SCRAM-')) { if (\str_starts_with($type, 'SCRAM-')) {
// RFC 5802 // 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); $sRequest = $SASL->challenge($sResult);
} else switch ($type) { } else switch ($type) {
// RFC 4616 // RFC 4616
@ -190,7 +194,9 @@ class SmtpClient extends \MailSo\Net\NetClient
break; break;
case 'LOGIN': 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); $sRequest = $SASL->challenge($sResult);
break; break;