diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' dolibarr.old/htdocs/core/class/ldap.class.php dolibarr.new/htdocs/core/class/ldap.class.php --- dolibarr.old/htdocs/core/class/ldap.class.php 2015-12-09 09:04:04.020654784 +0000 +++ dolibarr.new/htdocs/core/class/ldap.class.php 2015-12-09 10:38:57.736676283 +0000 @@ -149,7 +149,7 @@ */ function connect_bind() { - global $langs; + global $langs, $conf; $connected=0; $this->bind=0; @@ -184,6 +184,14 @@ $this->connection = ldap_connect($host,$this->serverPort); } + // Begin TLS if requested by the user's configuration + if (is_resource($this->connection) && !strcmp($conf->global->LDAP_SERVER_USE_TLS, "1")) { + if (!ldap_start_tls($this->connection)) { + $connected = 0; + $this->close(); + } + } + if (is_resource($this->connection)) { // Execute the ldap_set_option here (after connect and before bind)