Browse Source

Updated ldap_connect to use modern LDAP schema for better TLS support.

Ben Tyger 4 years ago
parent
commit
7e0e0db384
1 changed files with 4 additions and 1 deletions
  1. 4 1
      app/Controllers/Auth/AuthController.php

+ 4 - 1
app/Controllers/Auth/AuthController.php

@@ -35,7 +35,10 @@ abstract class AuthController extends Controller
             return false;
             return false;
         }
         }
 
 
-        $server = ldap_connect($this->config['ldap']['host'], $this->config['ldap']['port']);
+        $ldapSchema=array_key_exists('schema', $this->config['ldap']) ?
+        strtolower($this->config['ldap']['schema']) : 'ldap';
+        $ldapURI="$ldapSchema://".$this->config['ldap']['host'].':'.$this->config['ldap']['port'];
+        $server = ldap_connect($ldapURI);
 
 
         if ($server) {
         if ($server) {
             ldap_set_option($server, LDAP_OPT_PROTOCOL_VERSION, 3);
             ldap_set_option($server, LDAP_OPT_PROTOCOL_VERSION, 3);