For compatibility with the ldap_*() functions of PHP 8.1+
All checks were successful
gitea/evoadmin-mail/pipeline/head This commit looks good

This commit is contained in:
Mathieu Gauthier-Pilote 2024-10-29 12:00:19 -04:00
parent 8b1e791d2f
commit 65cb8e243e

View file

@ -77,10 +77,13 @@ class LdapServer {
public function login($password) {
$sr=ldap_search($this->conn, self::getBaseDN($this), "(&(uid=".$this->login.")(isAdmin=TRUE))");
if ($sr !== false) {
$info = ldap_get_entries($this->conn, $sr);
if (!$info['count']) {
Logger::error('Invalid login for '.$this->login);
throw new Exception("Échec de l'authentification, utilisateur ou mot de passe incorrect.");
if ($info == false || !$info['count']) {
Logger::error('Invalid login for '.$this->login);
throw new Exception("Échec de l'authentification, utilisateur ou mot de passe incorrect.");
}
}
if (!@ldap_bind($this->conn, $info[0]['dn'], $password)) {