mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 07:57:02 +03:00
Added "Allow self signed certificates" setting
Updated recaptcha plugin
This commit is contained in:
parent
46187d0749
commit
833f40c115
35 changed files with 363 additions and 273 deletions
|
|
@ -136,6 +136,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
|||
* @param int $iPort = 143
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return \MailSo\Imap\ImapClient
|
||||
*
|
||||
|
|
@ -144,11 +145,12 @@ 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 = false, $bAllowSelfSigned = true)
|
||||
{
|
||||
$this->aTagTimeouts['*'] = \microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned);
|
||||
|
||||
$this->parseResponseWithValidation('*', true);
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ abstract class NetClient
|
|||
* @param int $iPort
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
|
|
@ -203,7 +204,8 @@ 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 = false, $bAllowSelfSigned = true)
|
||||
{
|
||||
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
||||
{
|
||||
|
|
@ -251,12 +253,14 @@ abstract class NetClient
|
|||
// $iErrorNo, $sErrorStr, $this->iConnectTimeOut);
|
||||
|
||||
$bVerifySsl = !!$bVerifySsl;
|
||||
$bAllowSelfSigned = $bVerifySsl ? !!$bAllowSelfSigned : true;
|
||||
|
||||
$aStreamContextSettings = array(
|
||||
'ssl' => array(
|
||||
'verify_host' => $bVerifySsl,
|
||||
'verify_peer' => $bVerifySsl,
|
||||
'verify_peer_name' => $bVerifySsl,
|
||||
'allow_self_signed' => !$bVerifySsl
|
||||
'allow_self_signed' => $bAllowSelfSigned
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ class Pop3Client extends \MailSo\Net\NetClient
|
|||
* @param int $iPort = 110
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = null
|
||||
*
|
||||
* @return \MailSo\Pop3\Pop3Client
|
||||
*
|
||||
|
|
@ -71,11 +72,13 @@ class Pop3Client extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Pop3\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 110,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = false)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = null)
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned);
|
||||
|
||||
$this->validateResponse();
|
||||
|
||||
if (\MailSo\Net\Enumerations\ConnectionSecurityType::UseStartTLS(
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class PoppassdClient extends \MailSo\Net\NetClient
|
|||
* @param int $iPort = 106
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return \MailSo\Poppassd\PoppassdClient
|
||||
*
|
||||
|
|
@ -59,11 +60,13 @@ class PoppassdClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Poppassd\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort = 106,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = false)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true)
|
||||
{
|
||||
$this->iRequestTime = \microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned);
|
||||
|
||||
$this->validateResponse();
|
||||
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -26,12 +26,12 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
* @var array
|
||||
*/
|
||||
private $aCapa;
|
||||
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
private $iRequestTime;
|
||||
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
*/
|
||||
|
|
@ -55,7 +55,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sCapa
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function IsSupported($sCapa)
|
||||
|
|
@ -72,7 +72,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
return $this->IsSupported('SIEVE') && \in_array(\strtoupper($sModule), $this->aModules);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sAuth
|
||||
*
|
||||
|
|
@ -88,6 +88,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
* @param int $iPort
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return \MailSo\Sieve\ManageSieveClient
|
||||
*
|
||||
|
|
@ -96,12 +97,13 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
* @throws \MailSo\Sieve\Exceptions\ResponseException
|
||||
*/
|
||||
public function Connect($sServerName, $iPort,
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT, $bVerifySsl = false)
|
||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||
$bVerifySsl = false, $bAllowSelfSigned = true)
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned);
|
||||
|
||||
$mResponse = $this->parseResponse();
|
||||
$this->validateResponse($mResponse);
|
||||
$this->parseStartupResponse($mResponse);
|
||||
|
|
@ -122,7 +124,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
new \MailSo\Net\Exceptions\SocketUnsuppoterdSecureConnectionException('STARTTLS is not supported'),
|
||||
\MailSo\Log\Enumerations\Type::ERROR, true);
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +256,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
return $aResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
|
|
@ -273,7 +275,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @return \MailSo\Sieve\ManageSieveClient
|
||||
*
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Sieve\Exceptions\NegativeResponseException
|
||||
*/
|
||||
|
|
@ -286,7 +288,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sScriptName
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
|
|
@ -365,10 +367,10 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
public function SetActiveScript($sScriptName)
|
||||
{
|
||||
$this->sendRequestWithCheck('SETACTIVE "'.$sScriptName.'"');
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sScriptName
|
||||
*
|
||||
|
|
@ -409,7 +411,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sScriptName
|
||||
*
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
|
|
@ -419,7 +421,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
return $sScriptName === $this->GetActiveScriptName();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sLine
|
||||
* @return array|false
|
||||
|
|
@ -532,7 +534,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param string $sLine
|
||||
*
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function convertEndOfLine($sLine)
|
||||
|
|
@ -560,7 +562,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
return $sLine;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array|bool
|
||||
*/
|
||||
|
|
@ -572,7 +574,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
do
|
||||
{
|
||||
$this->getNextBuffer();
|
||||
|
||||
|
||||
$sLine = $this->sResponseBuffer;
|
||||
if (false === $sLine)
|
||||
{
|
||||
|
|
@ -620,7 +622,7 @@ class ManageSieveClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*
|
||||
*
|
||||
* @return \MailSo\Sieve\ManageSieveClient
|
||||
*
|
||||
* @throws \MailSo\Base\Exceptions\InvalidArgumentException
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
$sEhloHost = empty($_SERVER['HTTP_HOST']) ? '' : \trim($_SERVER['HTTP_HOST']);
|
||||
}
|
||||
|
||||
|
||||
if (empty($sEhloHost))
|
||||
{
|
||||
$sEhloHost = \function_exists('gethostname') ? \gethostname() : 'localhost';
|
||||
|
|
@ -151,6 +151,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
* @param string $sEhloHost = '[127.0.0.1]'
|
||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||
* @param bool $bVerifySsl = false
|
||||
* @param bool $bAllowSelfSigned = true
|
||||
*
|
||||
* @return \MailSo\Smtp\SmtpClient
|
||||
*
|
||||
|
|
@ -159,11 +160,13 @@ 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 = false, $bAllowSelfSigned = true)
|
||||
{
|
||||
$this->iRequestTime = microtime(true);
|
||||
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned);
|
||||
|
||||
$this->validateResponse(220);
|
||||
|
||||
$this->preLoginStartTLSAndEhloProcess($sEhloHost);
|
||||
|
|
@ -184,7 +187,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
public function Login($sLogin, $sPassword)
|
||||
{
|
||||
$sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
|
||||
|
||||
|
||||
if ($this->IsAuthSupported('LOGIN'))
|
||||
{
|
||||
try
|
||||
|
|
@ -313,7 +316,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
$sFrom = \MailSo\Base\Utils::IdnToAscii($sFrom, true);
|
||||
$sCmd = 'FROM:<'.$sFrom.'>';
|
||||
|
||||
|
||||
$sSizeIfSupported = (string) $sSizeIfSupported;
|
||||
if (0 < \strlen($sSizeIfSupported) && \is_numeric($sSizeIfSupported) && $this->IsSupported('SIZE'))
|
||||
{
|
||||
|
|
@ -538,7 +541,7 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
{
|
||||
$this->sendRequestWithCheck('STARTTLS', 220);
|
||||
$this->EnableCrypto();
|
||||
|
||||
|
||||
$this->ehloOrHelo($sEhloHost);
|
||||
}
|
||||
else if (\MailSo\Net\Enumerations\ConnectionSecurityType::STARTTLS === $this->iSecurityType)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue