mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-08 22:18:28 +03:00
Removed "Verify ssl certificate" setting (#332)
Added global "labs.verify_ssl_certificate" settings (default:true) (#332) Fixed php notices
This commit is contained in:
parent
56716cb5d3
commit
ecc2bdad24
12 changed files with 53 additions and 31 deletions
|
|
@ -126,7 +126,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @param string $sServerName
|
||||
* @param int $iPort = 143
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return \MailSo\Imap\ImapClient
|
||||
*
|
||||
|
|
@ -135,7 +135,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 143,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = false)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
$this->aTagTimeouts['*'] = \microtime(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class MailClient
|
|||
* @param string $sServerName
|
||||
* @param int $iPort = 143
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return \MailSo\Mail\MailClient
|
||||
*
|
||||
|
|
@ -57,9 +58,9 @@ class MailClient
|
|||
* @throws \MailSo\Imap\Exceptions\Exception
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 143,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
$this->oImapClient->Connect($sServerName, $iPort, $iSecurityType);
|
||||
$this->oImapClient->Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ abstract class NetClient
|
|||
* @param string $sServerName
|
||||
* @param int $iPort
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -194,7 +194,7 @@ abstract class NetClient
|
|||
* @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = false)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class Pop3Client extends \MailSo\Net\NetClient
|
|||
* @param string $sServerName
|
||||
* @param int $iPort = 110
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return \MailSo\Pop3\Pop3Client
|
||||
*
|
||||
|
|
@ -61,11 +62,11 @@ class Pop3Client extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Pop3\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 110,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
$this->validateResponse();
|
||||
|
||||
if (\MailSo\Net\Enumerations\ConnectionSecurityType::UseStartTLS(
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ class PoppassdClient extends \MailSo\Net\NetClient
|
|||
* @param string $sServerName
|
||||
* @param int $iPort = 106
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return \MailSo\Poppassd\PoppassdClient
|
||||
*
|
||||
|
|
@ -49,11 +50,11 @@ class PoppassdClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Poppassd\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 106,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
$this->iRequestTime = \microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
$this->validateResponse();
|
||||
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
* @param string $sServerName
|
||||
* @param int $iPort
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return \MailSo\Sieve\ManageSieveClient
|
||||
*
|
||||
|
|
@ -86,11 +87,11 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Sieve\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
|
||||
$mResponse = $this->parseResponse();
|
||||
$this->validateResponse($mResponse);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @param int $iPort = 25
|
||||
* @param string $sEhloHost = '[127.0.0.1]'
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bVerifySsl = true
|
||||
*
|
||||
* @return \MailSo\Smtp\SmtpClient
|
||||
*
|
||||
|
|
@ -150,7 +150,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Smtp\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 25, $sEhloHost = '[127.0.0.1]',
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = false)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = true)
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
<option value="2">STARTTLS</option>
|
||||
</select>
|
||||
|
||||
<label class="inline" data-bind="visible: '1' === imapSecure(), click: function () { imapVerifySsl(!imapVerifySsl()); }">
|
||||
<label class="inline" data-bind="visible: '1' === imapSecure() && false, click: function () { imapVerifySsl(!imapVerifySsl()); }">
|
||||
<i data-bind="css: imapVerifySsl() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
||||
|
||||
Verify ssl certificate
|
||||
|
|
@ -95,7 +95,7 @@
|
|||
<option value="2">STARTTLS</option>
|
||||
</select>
|
||||
|
||||
<label class="inline" data-bind="visible: '1' === smtpSecure(), click: function () { smtpVerifySsl(!smtpVerifySsl()); }">
|
||||
<label class="inline" data-bind="visible: '1' === smtpSecure() && false, click: function () { smtpVerifySsl(!smtpVerifySsl()); }">
|
||||
<i data-bind="css: smtpVerifySsl() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
|
||||
|
||||
Verify ssl certificate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue