Resolve #391 poppassd error

This commit is contained in:
the-djmaze 2022-05-13 22:58:09 +02:00
parent 05cd767761
commit 5757c06f77
3 changed files with 12 additions and 14 deletions

View file

@ -1,5 +1,7 @@
<?php <?php
use MailSo\Net\ConnectSettings;
class ChangePasswordPoppassdDriver extends \MailSo\Net\NetClient class ChangePasswordPoppassdDriver extends \MailSo\Net\NetClient
{ {
const const
@ -43,10 +45,10 @@ class ChangePasswordPoppassdDriver extends \MailSo\Net\NetClient
try try
{ {
$this->Connect( $oSettings = new ConnectSettings;
$this->oConfig->Get('plugin', 'poppassd_host', ''), $oSettings->host = $this->oConfig->Get('plugin', 'poppassd_host', '');
(int) $this->oConfig->Get('plugin', 'poppassd_port', 106) $oSettings->port = (int) $this->oConfig->Get('plugin', 'poppassd_port', 106);
); $this->Connect($oSettings);
if ($this->bIsLoggined) { if ($this->bIsLoggined) {
$this->writeLogException( $this->writeLogException(
@ -77,8 +79,7 @@ class ChangePasswordPoppassdDriver extends \MailSo\Net\NetClient
} }
$this->Disconnect() $this->Disconnect();
;
return true; return true;
} }
@ -93,13 +94,10 @@ class ChangePasswordPoppassdDriver extends \MailSo\Net\NetClient
$bIsLoggined = false, $bIsLoggined = false,
$iRequestTime = 0; $iRequestTime = 0;
public function Connect(string $sServerName, int $iPort, public function Connect(ConnectSettings $oSettings) : void
int $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::AUTO_DETECT,
bool $bVerifySsl = false, bool $bAllowSelfSigned = true,
string $sClientCert = '') : void
{ {
$this->iRequestTime = \microtime(true); $this->iRequestTime = \microtime(true);
parent::Connect($sServerName, $iPort, $iSecurityType, $bVerifySsl, $bAllowSelfSigned, $sClientCert); parent::Connect($oSettings);
$this->validateResponse(); $this->validateResponse();
} }

View file

@ -6,9 +6,9 @@ class ChangePasswordPoppassdPlugin extends \RainLoop\Plugins\AbstractPlugin
{ {
const const
NAME = 'Change Password Poppassd', NAME = 'Change Password Poppassd',
VERSION = '2.14', VERSION = '2.15',
RELEASE = '2022-04-28', RELEASE = '2022-04-28',
REQUIRED = '2.12.0', REQUIRED = '2.15.3',
CATEGORY = 'Security', CATEGORY = 'Security',
DESCRIPTION = 'Extension to allow users to change their passwords through Poppassd'; DESCRIPTION = 'Extension to allow users to change their passwords through Poppassd';

View file

@ -120,7 +120,7 @@ abstract class NetClient
* @throws \MailSo\Net\Exceptions\SocketAlreadyConnectedException * @throws \MailSo\Net\Exceptions\SocketAlreadyConnectedException
* @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException * @throws \MailSo\Net\Exceptions\SocketCanNotConnectToHostException
*/ */
public function Connect(ConnectSettings $oSettings) public function Connect(ConnectSettings $oSettings) : void
{ {
$oSettings->host = \trim($oSettings->host); $oSettings->host = \trim($oSettings->host);
if (!\strlen($oSettings->host) || !\MailSo\Base\Validator::PortInt($oSettings->port)) { if (!\strlen($oSettings->host) || !\MailSo\Base\Validator::PortInt($oSettings->port)) {