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

View file

@ -6,9 +6,9 @@ class ChangePasswordPoppassdPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Change Password Poppassd',
VERSION = '2.14',
VERSION = '2.15',
RELEASE = '2022-04-28',
REQUIRED = '2.12.0',
REQUIRED = '2.15.3',
CATEGORY = 'Security',
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\SocketCanNotConnectToHostException
*/
public function Connect(ConnectSettings $oSettings)
public function Connect(ConnectSettings $oSettings) : void
{
$oSettings->host = \trim($oSettings->host);
if (!\strlen($oSettings->host) || !\MailSo\Base\Validator::PortInt($oSettings->port)) {