Removed "Verify ssl certificate" setting (#332)

Added global "labs.verify_ssl_certificate" settings (default:true) (#332)
Fixed php notices
This commit is contained in:
RainLoop Team 2014-10-07 18:47:37 +04:00
parent 56716cb5d3
commit ecc2bdad24
12 changed files with 53 additions and 31 deletions

View file

@ -1373,7 +1373,8 @@ class Actions
{
$this->MailClient()
->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure())
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure(),
$oAccount->Domain()->IncVerifySsl(!!$this->Config()->Get('labs', 'verify_ssl_certificate')))
->Login($oAccount->IncLogin(), $oAccount->Password())
;
}
@ -2784,7 +2785,7 @@ class Actions
$iTime = \microtime(true);
$oImapClient->Connect($oDomain->IncHost($oDomain->Name()), $oDomain->IncPort(),
$oDomain->IncSecure(), $oDomain->IncVerifySsl());
$oDomain->IncSecure(), $oDomain->IncVerifySsl(!!$this->Config()->Get('labs', 'verify_ssl_certificate')));
$iImapTime = \microtime(true) - $iTime;
$oImapClient->Disconnect();
@ -2812,7 +2813,7 @@ class Actions
$iTime = \microtime(true);
$oSmtpClient->Connect($oDomain->OutHost($oDomain->Name()), $oDomain->OutPort(), '127.0.0.1',
$oDomain->OutSecure(), $oDomain->OutVerifySsl());
$oDomain->OutSecure(), $oDomain->OutVerifySsl(!!$this->Config()->Get('labs', 'verify_ssl_certificate')));
$iSmtpTime = \microtime(true) - $iTime;
$oSmtpClient->Disconnect();
@ -4651,6 +4652,15 @@ class Actions
return $this->DefaultResponse(__FUNCTION__, $mResult);
}
/**
*
* @param \RainLoop\Account $oAccount
* @param type $oMessage
* @param type $rMessageStream
* @param type $bAddHiddenRcpt
* @throws \RainLoop\Exceptions\ClientException
* @throws \MailSo\Net\Exceptions\ConnectionException
*/
private function smtpSendMessage($oAccount, $oMessage, $rMessageStream, $bAddHiddenRcpt = true)
{
$oRcpt = $oMessage->GetRcpt();
@ -4674,6 +4684,7 @@ class Actions
'From' => empty($sFrom) ? $oAccount->Email() : $sFrom,
'Login' => $oAccount->OutLogin(),
'Password' => $oAccount->Password(),
'VerifySsl' => $oAccount->Domain()->OutVerifySsl(!!$this->Config()->Get('labs', 'verify_ssl_certificate')),
'HiddenRcpt' => array()
);
@ -4692,7 +4703,7 @@ class Actions
if (!$bHookConnect)
{
$oSmtpClient->Connect($aSmtpCredentials['Host'], $aSmtpCredentials['Port'],
$aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure']);
$aSmtpCredentials['Ehlo'], $aSmtpCredentials['Secure'], $aSmtpCredentials['VerifySsl']);
}
if (!$bHookAuth)
@ -5442,10 +5453,6 @@ class Actions
if ($oAddressBookProvider && $oAddressBookProvider->IsActive() && 0 < \strlen($sRequestUid))
{
$sUid = \trim($this->GetActionParam('Uid', ''));
$sTags = \trim($this->GetActionParam('Tags', ''));
$aTags = \explode(',', $sTags);
$aTags = \array_map('trim', $aTags);
$aTags = \array_unique($aTags);
$oContact = null;
if (0 < \strlen($sUid))
@ -5462,7 +5469,6 @@ class Actions
}
}
$oContact->Tags = $aTags;
$oContact->Properties = array();
$aProperties = $this->GetActionParam('Properties', array());
if (\is_array($aProperties))
@ -6654,7 +6660,8 @@ class Actions
{
$this->MailClient()
->Connect($oAccount->Domain()->IncHost(\MailSo\Base\Utils::GetDomainFromEmail($oAccount->Email())),
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure())
$oAccount->Domain()->IncPort(), $oAccount->Domain()->IncSecure(),
$oAccount->Domain()->IncVerifySsl(!!$this->Config()->Get('labs', 'verify_ssl_certificate')))
->Login($oAccount->IncLogin(), $oAccount->Password(), !!$this->Config()->Get('labs', 'use_imap_auth_plain'))
;
}
@ -7543,7 +7550,6 @@ class Actions
'Display' => \MailSo\Base\Utils::Utf8Clear($mResponse->Display),
'ReadOnly' => $mResponse->ReadOnly,
'IdPropertyFromSearch' => $mResponse->IdPropertyFromSearch,
'Tags' => $this->responseObject($mResponse->Tags, $sParent, $aParameters),
'Properties' => $this->responseObject($mResponse->Properties, $sParent, $aParameters)
));
}

View file

@ -101,6 +101,7 @@ class Application extends \RainLoop\Config\AbstractConfig
'Enable CSRF protection (http://en.wikipedia.org/wiki/Cross-site_request_forgery)'),
'custom_server_signature' => array('RainLoop'),
'x_frame_options_header' => array('SAMEORIGIN'),
'openpgp' => array(false),
'use_rsa_encryption' => array(false),
'admin_login' => array('admin', 'Login and password for web admin panel'),
@ -248,6 +249,7 @@ Enables caching in the system'),
'imap_message_list_date_filter' => array(0),
'imap_large_thread_limit' => array(100),
'smtp_show_server_errors' => array(false),
'verify_ssl_certificate' => array(true),
'curl_proxy' => array(''),
'curl_proxy_auth' => array(''),
'in_iframe' => array(false),

View file

@ -338,11 +338,13 @@ class Domain
}
/**
* @param bool|null $bGlobalVerify = null
*
* @return bool
*/
public function IncVerifySsl()
public function IncVerifySsl($bGlobalVerify = null)
{
return $this->bIncVerifySsl;
return null === $bGlobalVerify ? $this->bIncVerifySsl : !!$bGlobalVerify;
}
/**
@ -379,11 +381,13 @@ class Domain
}
/**
* @param bool|null $bGlobalVerify = null
*
* @return bool
*/
public function OutVerifySsl()
public function OutVerifySsl($bGlobalVerify = null)
{
return $this->bOutVerifySsl;
return null === $bGlobalVerify ? $this->bOutVerifySsl : !!$bGlobalVerify;
}
/**

View file

@ -42,6 +42,12 @@ class Service
{
@\header('Server: '.$sServer, true);
}
$sXFrameOptionsHeader = \trim($this->oActions->Config()->Get('security', 'x_frame_options_header', ''));
if (0 < \strlen($sXFrameOptionsHeader))
{
@\header('X-Frame-Options: '.$sXFrameOptionsHeader, true);
}
if ($this->oActions->Config()->Get('labs', 'force_https', false) && !$this->oHttp->IsSecure())
{