Index: auth/ldap/auth.php =================================================================== --- auth/ldap/auth.php (revision 290) +++ auth/ldap/auth.php (working copy) @@ -57,13 +57,13 @@ $this->config->{$key} = $value[$this->config->user_type]; } } + //hack prefix to objectclass if (empty($this->config->objectclass)) { // Can't send empty filter $this->config->objectclass='objectClass=*'; } else if (stripos($this->config->objectclass, 'objectClass=') !== 0) { $this->config->objectclass = 'objectClass='.$this->config->objectclass; } - } /** @@ -1558,6 +1558,10 @@ ldap_set_option($connresult, LDAP_OPT_PROTOCOL_VERSION, $this->config->version); } + if ($this->config->tls) { + ldap_start_tls($connresult); + } + // Fix MDL-10921 if ($this->config->user_type == 'ad') { ldap_set_option($connresult, LDAP_OPT_REFERRALS, 0); @@ -1917,6 +1921,8 @@ // set to defaults if undefined if (!isset($config->host_url)) { $config->host_url = ''; } + if (!isset($config->tls)) + { $config->tls = 0; } if (empty($config->ldapencoding)) { $config->ldapencoding = 'utf-8'; } if (!isset($config->contexts)) @@ -1976,8 +1982,8 @@ // save settings set_config('host_url', $config->host_url, 'auth/ldap'); + set_config('tls', $config->tls, 'auth/ldap'); set_config('ldapencoding', $config->ldapencoding, 'auth/ldap'); - set_config('host_url', $config->host_url, 'auth/ldap'); set_config('contexts', $config->contexts, 'auth/ldap'); set_config('user_type', $config->user_type, 'auth/ldap'); set_config('user_attribute', $config->user_attribute, 'auth/ldap'); Index: auth/ldap/config.html =================================================================== --- auth/ldap/config.html (revision 290) +++ auth/ldap/config.html (working copy) @@ -3,6 +3,8 @@ // set to defaults if undefined if (!isset($config->host_url)) { $config->host_url = ''; } + if (!isset($config->tls)) + { $config->tls = 0; } if (empty($config->ldapencoding)) { $config->ldapencoding = 'utf-8'; } if (!isset($config->contexts)) @@ -87,10 +89,24 @@