Fix: check connectivity for avoid ldap errors

This commit is contained in:
Regis Houssin 2017-09-16 17:12:51 +02:00
parent f584212700
commit 4ab1f68102
2 changed files with 471 additions and 475 deletions

View File

@ -195,15 +195,15 @@ class Ldap
if (is_resource($this->connection)) if (is_resource($this->connection))
{ {
// Begin TLS if requested by the configuration // Begin TLS if requested by the configuration
if (! empty($conf->global->LDAP_SERVER_USE_TLS)) if (! empty($conf->global->LDAP_SERVER_USE_TLS))
{ {
if (! ldap_start_tls($this->connection)) if (! ldap_start_tls($this->connection))
{ {
dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING); dol_syslog(get_class($this)."::connect_bind failed to start tls", LOG_WARNING);
$connected = 0; $connected = 0;
$this->close(); $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();