mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
Small refactoring: CramMd5
This commit is contained in:
parent
2ab17f8eff
commit
acaeb82397
4 changed files with 19 additions and 19 deletions
|
|
@ -177,6 +177,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
* @param string $sProxyAuthUser = ''
|
* @param string $sProxyAuthUser = ''
|
||||||
* @param bool $bUseAuthPlainIfSupported = false
|
* @param bool $bUseAuthPlainIfSupported = false
|
||||||
|
* @param bool $bUseAuthCramMd5IfSupported = false
|
||||||
*
|
*
|
||||||
* @return \MailSo\Imap\ImapClient
|
* @return \MailSo\Imap\ImapClient
|
||||||
*
|
*
|
||||||
|
|
@ -184,7 +185,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function Login($sLogin, $sPassword, $sProxyAuthUser = '', $bUseAuthPlainIfSupported = false)
|
public function Login($sLogin, $sPassword, $sProxyAuthUser = '',
|
||||||
|
$bUseAuthPlainIfSupported = false, $bUseAuthCramMd5IfSupported = false)
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) ||
|
if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) ||
|
||||||
!\MailSo\Base\Validator::NotEmptyString($sPassword, true))
|
!\MailSo\Base\Validator::NotEmptyString($sPassword, true))
|
||||||
|
|
@ -202,8 +204,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// TODO
|
$bUseAuthCramMd5IfSupported = false; // TODO
|
||||||
if (false && $this->IsSupported('AUTH=CRAM-MD5'))
|
if ($bUseAuthCramMd5IfSupported && $this->IsSupported('AUTH=CRAM-MD5'))
|
||||||
{
|
{
|
||||||
$this->SendRequest('AUTHENTICATE', array('CRAM-MD5'));
|
$this->SendRequest('AUTHENTICATE', array('CRAM-MD5'));
|
||||||
|
|
||||||
|
|
@ -220,22 +222,16 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($oContinuationResponse)
|
if ($oContinuationResponse && false)
|
||||||
{
|
{
|
||||||
$sToken = \base64_encode("\0".$sLogin."\0".$sPassword);
|
// TODO
|
||||||
if ($this->oLogger)
|
|
||||||
{
|
|
||||||
$this->oLogger->AddSecret($sToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->Logger()->WriteDump($aResponse);
|
$this->Logger()->WriteDump($aResponse);
|
||||||
|
|
||||||
$this->sendRaw($sToken, true, '*******');
|
|
||||||
$this->parseResponseWithValidation();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO
|
$this->writeLogException(
|
||||||
|
new \MailSo\Imap\Exceptions\LoginException(),
|
||||||
|
\MailSo\Log\Enumerations\Type::NOTICE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ class MailClient
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
* @param string $sProxyAuthUser = ''
|
* @param string $sProxyAuthUser = ''
|
||||||
* @param bool $bUseAuthPlainIfSupported = false
|
* @param bool $bUseAuthPlainIfSupported = false
|
||||||
|
* @param bool $bUseAuthCramMd5IfSupported = false
|
||||||
*
|
*
|
||||||
* @return \MailSo\Mail\MailClient
|
* @return \MailSo\Mail\MailClient
|
||||||
*
|
*
|
||||||
|
|
@ -85,9 +86,10 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\LoginException
|
* @throws \MailSo\Imap\Exceptions\LoginException
|
||||||
*/
|
*/
|
||||||
public function Login($sLogin, $sPassword, $sProxyAuthUser = '', $bUseAuthPlainIfSupported = false)
|
public function Login($sLogin, $sPassword, $sProxyAuthUser = '',
|
||||||
|
$bUseAuthPlainIfSupported = false, $bUseAuthCramMd5IfSupported = false)
|
||||||
{
|
{
|
||||||
$this->oImapClient->Login($sLogin, $sPassword, $sProxyAuthUser, $bUseAuthPlainIfSupported);
|
$this->oImapClient->Login($sLogin, $sPassword, $sProxyAuthUser, $bUseAuthPlainIfSupported, $bUseAuthCramMd5IfSupported);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,7 @@ Enables caching in the system'),
|
||||||
'use_imap_thread' => array(true),
|
'use_imap_thread' => array(true),
|
||||||
'use_imap_move' => array(false),
|
'use_imap_move' => array(false),
|
||||||
'use_imap_auth_plain' => array(false),
|
'use_imap_auth_plain' => array(false),
|
||||||
|
'use_imap_auth_cram_md5' => array(false),
|
||||||
'use_imap_expunge_all_on_delete' => array(false),
|
'use_imap_expunge_all_on_delete' => array(false),
|
||||||
'imap_forwarded_flag' => array('$Forwarded'),
|
'imap_forwarded_flag' => array('$Forwarded'),
|
||||||
'imap_read_receipt_flag' => array('$ReadReceipt'),
|
'imap_read_receipt_flag' => array('$ReadReceipt'),
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,8 @@ class Account extends \RainLoop\Account // for backward compatibility
|
||||||
'ProxyAuthPassword' => $this->ProxyAuthPassword(),
|
'ProxyAuthPassword' => $this->ProxyAuthPassword(),
|
||||||
'VerifySsl' => !!$oConfig->Get('ssl', 'verify_certificate', false),
|
'VerifySsl' => !!$oConfig->Get('ssl', 'verify_certificate', false),
|
||||||
'AllowSelfSigned' => !!$oConfig->Get('ssl', 'allow_self_signed', true),
|
'AllowSelfSigned' => !!$oConfig->Get('ssl', 'allow_self_signed', true),
|
||||||
'UseAuthPlainIfSupported' => !!$oConfig->Get('labs', 'use_imap_auth_plain')
|
'UseAuthPlainIfSupported' => !!$oConfig->Get('labs', 'use_imap_auth_plain'),
|
||||||
|
'UseAuthCramMd5IfSupported' => !!$oConfig->Get('labs', 'use_imap_auth_cram_md5')
|
||||||
);
|
);
|
||||||
|
|
||||||
$oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials));
|
$oPlugins->RunHook('filter.imap-credentials', array($this, &$aImapCredentials));
|
||||||
|
|
@ -433,7 +434,7 @@ class Account extends \RainLoop\Account // for backward compatibility
|
||||||
{
|
{
|
||||||
$oMailClient
|
$oMailClient
|
||||||
->Login($aImapCredentials['ProxyAuthUser'], $aImapCredentials['ProxyAuthPassword'],
|
->Login($aImapCredentials['ProxyAuthUser'], $aImapCredentials['ProxyAuthPassword'],
|
||||||
$aImapCredentials['Login'], $aImapCredentials['UseAuthPlainIfSupported']);
|
$aImapCredentials['Login'], $aImapCredentials['UseAuthPlainIfSupported'], $aImapCredentials['UseAuthCramMd5IfSupported']);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -447,7 +448,7 @@ class Account extends \RainLoop\Account // for backward compatibility
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oMailClient->Login($aImapCredentials['Login'], $aImapCredentials['Password'], '',
|
$oMailClient->Login($aImapCredentials['Login'], $aImapCredentials['Password'], '',
|
||||||
$aImapCredentials['UseAuthPlainIfSupported']);
|
$aImapCredentials['UseAuthPlainIfSupported'], $aImapCredentials['UseAuthCramMd5IfSupported']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue