FIX Option start tls of ldap was not correctly supported.

This commit is contained in:
Laurent Destailleur 2015-12-13 15:51:52 +01:00
parent ef33691818
commit 7db6ac592f

View File

@ -149,7 +149,7 @@ class Ldap
*/ */
function connect_bind() function connect_bind()
{ {
global $langs; global $langs, $conf;
$connected=0; $connected=0;
$this->bind=0; $this->bind=0;
@ -186,6 +186,17 @@ class Ldap
if (is_resource($this->connection)) if (is_resource($this->connection))
{ {
// Begin TLS if requested by the configuration
if (! empty($conf->global->LDAP_SERVER_USE_TLS))
{
if (! ldap_start_tls($this->connection))
{
dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING);
$connected = 0;
$this->close();
}
}
// Execute the ldap_set_option here (after connect and before bind) // Execute the ldap_set_option here (after connect and before bind)
$this->setVersion(); $this->setVersion();
ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true. ldap_set_option($this->connection, LDAP_OPT_SIZELIMIT, 0); // no limit here. should return true.