mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
MailSo changes for TLS certs
This commit is contained in:
parent
930f6dbb6d
commit
4cd86ede0b
3 changed files with 12 additions and 7 deletions
|
|
@ -137,6 +137,7 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||||
* @param bool $bVerifySsl = false
|
* @param bool $bVerifySsl = false
|
||||||
* @param bool $bAllowSelfSigned = true
|
* @param bool $bAllowSelfSigned = true
|
||||||
|
* @param string $sClientCert = NULL
|
||||||
*
|
*
|
||||||
* @return \MailSo\Imap\ImapClient
|
* @return \MailSo\Imap\ImapClient
|
||||||
*
|
*
|
||||||
|
|
@ -146,11 +147,12 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function Connect($sServerName, $iPort = 143,
|
public function Connect($sServerName, $iPort = 143,
|
||||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||||
$bVerifySsl = false, $bAllowSelfSigned = true)
|
$bVerifySsl = false, $bAllowSelfSigned = true,
|
||||||
|
$sClientCert = '')
|
||||||
{
|
{
|
||||||
$this->aTagTimeouts['*'] = \microtime(true);
|
$this->aTagTimeouts['*'] = \microtime(true);
|
||||||
|
|
||||||
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned);
|
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned, $sClientCert);
|
||||||
|
|
||||||
$this->parseResponseWithValidation('*', true);
|
$this->parseResponseWithValidation('*', true);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class MailClient
|
||||||
* @param int $iPort = 143
|
* @param int $iPort = 143
|
||||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||||
* @param bool $bVerifySsl = false
|
* @param bool $bVerifySsl = false
|
||||||
|
* @param string $sClientCert = ""
|
||||||
*
|
*
|
||||||
* @return \MailSo\Mail\MailClient
|
* @return \MailSo\Mail\MailClient
|
||||||
*
|
*
|
||||||
|
|
@ -67,9 +68,9 @@ class MailClient
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function Connect($sServerName, $iPort = 143,
|
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 = false, $sClientCert = '')
|
||||||
{
|
{
|
||||||
$this->oImapClient->Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl);
|
$this->oImapClient->Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned, $sClientCert);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,7 @@ abstract class NetClient
|
||||||
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
* @param int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT
|
||||||
* @param bool $bVerifySsl = false
|
* @param bool $bVerifySsl = false
|
||||||
* @param bool $bAllowSelfSigned = true
|
* @param bool $bAllowSelfSigned = true
|
||||||
|
* @param string $sClientCert = NULL
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -205,7 +206,8 @@ abstract class NetClient
|
||||||
*/
|
*/
|
||||||
public function Connect($sServerName, $iPort,
|
public function Connect($sServerName, $iPort,
|
||||||
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
|
||||||
$bVerifySsl = false, $bAllowSelfSigned = true)
|
$bVerifySsl = false, $bAllowSelfSigned = true,
|
||||||
|
$sClientCert = '')
|
||||||
{
|
{
|
||||||
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
if (!\MailSo\Base\Validator::NotEmptyString($sServerName, true) || !\MailSo\Base\Validator::PortInt($iPort))
|
||||||
{
|
{
|
||||||
|
|
@ -254,13 +256,13 @@ abstract class NetClient
|
||||||
|
|
||||||
$bVerifySsl = !!$bVerifySsl;
|
$bVerifySsl = !!$bVerifySsl;
|
||||||
$bAllowSelfSigned = $bVerifySsl ? !!$bAllowSelfSigned : true;
|
$bAllowSelfSigned = $bVerifySsl ? !!$bAllowSelfSigned : true;
|
||||||
|
|
||||||
$aStreamContextSettings = array(
|
$aStreamContextSettings = array(
|
||||||
'ssl' => array(
|
'ssl' => array(
|
||||||
'verify_host' => $bVerifySsl,
|
'verify_host' => $bVerifySsl,
|
||||||
'verify_peer' => $bVerifySsl,
|
'verify_peer' => $bVerifySsl,
|
||||||
'verify_peer_name' => $bVerifySsl,
|
'verify_peer_name' => $bVerifySsl,
|
||||||
'allow_self_signed' => $bAllowSelfSigned
|
'allow_self_signed' => $bAllowSelfSigned,
|
||||||
|
'local_cert' => $sClientCert
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue