diff options
-rw-r--r-- | application/security/LoginManager.php | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/application/security/LoginManager.php b/application/security/LoginManager.php index 5f395a87..39ec9b2e 100644 --- a/application/security/LoginManager.php +++ b/application/security/LoginManager.php | |||
@@ -204,12 +204,20 @@ class LoginManager | |||
204 | */ | 204 | */ |
205 | public function checkCredentialsFromLdap($login, $password, $connect = null, $bind = null) | 205 | public function checkCredentialsFromLdap($login, $password, $connect = null, $bind = null) |
206 | { | 206 | { |
207 | $connect = $connect ?? function($host) { return ldap_connect($host); }; | 207 | $connect = $connect ?? function($host) { |
208 | $bind = $bind ?? function($handle, $dn, $password) { return ldap_bind($handle, $dn, $password); }; | 208 | $resource = ldap_connect($host); |
209 | |||
210 | ldap_set_option($resource, LDAP_OPT_PROTOCOL_VERSION, 3); | ||
211 | |||
212 | return $resource; | ||
213 | }; | ||
214 | $bind = $bind ?? function($handle, $dn, $password) { | ||
215 | return ldap_bind($handle, $dn, $password); | ||
216 | }; | ||
209 | 217 | ||
210 | return $bind( | 218 | return $bind( |
211 | $connect($this->configManager->get('ldap.host')), | 219 | $connect($this->configManager->get('ldap.host')), |
212 | sprintf($this->configManager->get('ldap.dn'), $login), | 220 | sprintf($this->configManager->get('ldap.dn'), $login), |
213 | $password | 221 | $password |
214 | ); | 222 | ); |
215 | } | 223 | } |