mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-07 17:06:54 +01:00
* [FIX] Related #540. Set the LDAP server port when it's set within the hostname. Thanks to @bitking for the feedback.
This commit is contained in:
@@ -62,6 +62,10 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
* @var string
|
||||
*/
|
||||
protected $server;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $serverPort;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
@@ -161,7 +165,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
@ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
|
||||
}
|
||||
|
||||
$this->ldapHandler = @ldap_connect($this->server);
|
||||
$this->ldapHandler = @ldap_connect($this->server, $this->serverPort);
|
||||
|
||||
// Conexión al servidor LDAP
|
||||
if (!is_resource($this->ldapHandler)) {
|
||||
@@ -320,6 +324,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
public function setServer($server)
|
||||
{
|
||||
$this->server = $server;
|
||||
$this->serverPort = $this->getServerPort();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,6 +442,7 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
{
|
||||
$this->searchBase = Config::getConfig()->getLdapBase();
|
||||
$this->server = $this->pickServer();
|
||||
$this->serverPort = $this->getServerPort();
|
||||
$this->bindDn = Config::getConfig()->getLdapBindUser();
|
||||
$this->bindPass = Config::getConfig()->getLdapBindPass();
|
||||
$this->group = Config::getConfig()->getLdapGroup();
|
||||
@@ -454,6 +460,16 @@ abstract class LdapBase implements LdapInterface, AuthInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devolver el puerto del servidor si está establecido
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getServerPort()
|
||||
{
|
||||
return preg_match('/[\d\.]+:(\d+)/', $this->server, $port) ? $port[1] : 389;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtener el servidor de LDAP a utilizar
|
||||
*
|
||||
|
||||
@@ -407,8 +407,8 @@ class Util
|
||||
*/
|
||||
public static function getVersion($retBuild = false, $normalized = false)
|
||||
{
|
||||
$build = 17041401;
|
||||
$version = [2, 1, 6];
|
||||
$build = 17041402;
|
||||
$version = [2, 1, 7];
|
||||
|
||||
if ($normalized === true) {
|
||||
return [implode('', $version), $build];
|
||||
|
||||
Reference in New Issue
Block a user