mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-13 16:44:37 +08:00
Add confog for sieve auth plain command
This commit is contained in:
parent
c72c6c0946
commit
0f6b70f63e
5 changed files with 1804 additions and 1781 deletions
|
@ -32,6 +32,11 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
*/
|
||||
private $iRequestTime;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $__USE_INITIAL_AUTH_PLAIN_COMMAND;
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*/
|
||||
|
@ -43,6 +48,8 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
$this->iRequestTime = 0;
|
||||
$this->aCapa = array();
|
||||
$this->aModules = array();
|
||||
|
||||
$this->__USE_INITIAL_AUTH_PLAIN_COMMAND = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,7 +173,15 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
$sAuth = \base64_encode($sLoginAuthKey."\0".$sLogin."\0".$sPassword);
|
||||
|
||||
$this->sendRequest('AUTHENTICATE "PLAIN" "'.$sAuth.'"');
|
||||
if ($this->__USE_INITIAL_AUTH_PLAIN_COMMAND)
|
||||
{
|
||||
$this->sendRequest('AUTHENTICATE "PLAIN" "'.$sAuth.'"');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->sendRequest('AUTHENTICATE "PLAIN" {'.\strlen($sAuth).'+}');
|
||||
$this->sendRequest($sAuth);
|
||||
}
|
||||
|
||||
$mResponse = $this->parseResponse();
|
||||
$this->validateResponse($mResponse);
|
||||
|
|
|
@ -4210,6 +4210,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
|||
{
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->Logger());
|
||||
$oSieveClient->SetTimeOuts($iConnectionTimeout);
|
||||
$oSieveClient->__USE_INITIAL_AUTH_PLAIN_COMMAND = !!$this->Config()->Get('labs', 'sieve_auth_plain_initial', true);
|
||||
|
||||
$iTime = \microtime(true);
|
||||
$oSieveClient->Connect($oDomain->SieveHost(), $oDomain->SievePort(), $oDomain->SieveSecure(),
|
||||
|
|
|
@ -421,6 +421,7 @@ Enables caching in the system'),
|
|||
'smtp_use_auth_cram_md5' => array(false),
|
||||
'sieve_allow_raw_script' => array(false),
|
||||
'sieve_utf8_folder_name' => array(true),
|
||||
'sieve_auth_plain_initial' => array(true),
|
||||
'imap_timeout' => array(300),
|
||||
'smtp_timeout' => array(60),
|
||||
'sieve_timeout' => array(10),
|
||||
|
|
|
@ -547,18 +547,24 @@ class Account extends \RainLoop\Account // for backward compatibility
|
|||
'Login' => $this->IncLogin(),
|
||||
'Password' => $this->Password(),
|
||||
'VerifySsl' => !!$oConfig->Get('ssl', 'verify_certificate', false),
|
||||
'AllowSelfSigned' => !!$oConfig->Get('ssl', 'allow_self_signed', true)
|
||||
'AllowSelfSigned' => !!$oConfig->Get('ssl', 'allow_self_signed', true),
|
||||
'InitialAuthPlain' => !!$oConfig->Get('ssl', 'sieve_auth_plain_initial', true)
|
||||
);
|
||||
|
||||
$oPlugins->RunHook('filter.sieve-credentials', array($this, &$aSieveCredentials));
|
||||
|
||||
$oPlugins->RunHook('event.sieve-pre-connect', array($this, $aSieveCredentials['UseConnect'], $aSieveCredentials));
|
||||
|
||||
if ($aSieveCredentials['UseConnect'] && $oSieveClient)
|
||||
if ($oSieveClient)
|
||||
{
|
||||
$oSieveClient->Connect($aSieveCredentials['Host'], $aSieveCredentials['Port'],
|
||||
$aSieveCredentials['Secure'], $aSieveCredentials['VerifySsl'], $aSieveCredentials['AllowSelfSigned']
|
||||
);
|
||||
$oSieveClient->__USE_INITIAL_AUTH_PLAIN_COMMAND = $aSieveCredentials['InitialAuthPlain'];
|
||||
|
||||
if ($aSieveCredentials['UseConnect'])
|
||||
{
|
||||
$oSieveClient->Connect($aSieveCredentials['Host'], $aSieveCredentials['Port'],
|
||||
$aSieveCredentials['Secure'], $aSieveCredentials['VerifySsl'], $aSieveCredentials['AllowSelfSigned']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$oPlugins->RunHook('event.sieve-post-connect', array($this, $aSieveCredentials['UseConnect'], $aSieveCredentials));
|
||||
|
|
|
@ -59,7 +59,7 @@ class SieveStorage implements \RainLoop\Providers\Filters\FiltersInterface
|
|||
$aFilters = array();
|
||||
|
||||
$oSieveClient = \MailSo\Sieve\ManageSieveClient::NewInstance()->SetLogger($this->oLogger);
|
||||
$oSieveClient->SetTimeOuts(10, (int) \RainLoop\Api::Config()->Get('labs', 'sieve_timeout', 10));
|
||||
$oSieveClient->SetTimeOuts(10, (int) $this->oConfig->Get('labs', 'sieve_timeout', 10));
|
||||
|
||||
if ($oAccount->SieveConnectAndLoginHelper($this->oPlugins, $oSieveClient, $this->oConfig))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue