diff --git a/inc/SP/Auth/Ldap/LdapBase.class.php b/inc/SP/Auth/Ldap/LdapBase.class.php index 143c4178..ed0d7d58 100644 --- a/inc/SP/Auth/Ldap/LdapBase.class.php +++ b/inc/SP/Auth/Ldap/LdapBase.class.php @@ -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 * diff --git a/inc/SP/Util/Util.class.php b/inc/SP/Util/Util.class.php index 5179a587..6b068413 100644 --- a/inc/SP/Util/Util.class.php +++ b/inc/SP/Util/Util.class.php @@ -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];