Fix: si le DN des users est différente du DN de l'admin on cherche dans le domaine en entier afin de trouver l'admin
This commit is contained in:
parent
07625fc443
commit
2e707edb51
@ -883,18 +883,34 @@ class Ldap
|
|||||||
$this->bindauth($this->searchUser, $this->searchPassword);
|
$this->bindauth($this->searchUser, $this->searchPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ldapSearchResult = @ldap_search($this->connection, $this->people, $criteria, $justthese);
|
$i = 0;
|
||||||
|
$searchDN = $this->people;
|
||||||
|
|
||||||
// Si pas de résultat on cherche dans le domaine
|
while ($i <= 2)
|
||||||
if (!$ldapSearchResult) $ldapSearchResult = @ldap_search($this->connection, $this->domain, $criteria, $justthese);
|
|
||||||
|
|
||||||
if (!$ldapSearchResult)
|
|
||||||
{
|
{
|
||||||
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
$ldapSearchResult = @ldap_search($this->connection, $searchDN, $criteria, $justthese);
|
||||||
return -1;
|
|
||||||
|
if (!$ldapSearchResult)
|
||||||
|
{
|
||||||
|
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$entry = ldap_first_entry($this->connection, $ldapSearchResult);
|
||||||
|
|
||||||
|
if (!$entry)
|
||||||
|
{
|
||||||
|
// Si pas de résultat on cherche dans le domaine
|
||||||
|
$searchDN = $this->domain;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry = ldap_first_entry($this->connection, $ldapSearchResult);
|
|
||||||
if ($entry)
|
if ($entry)
|
||||||
{
|
{
|
||||||
$ldapBinary = ldap_get_values_len ($this->connection, $entry, "objectsid");
|
$ldapBinary = ldap_get_values_len ($this->connection, $entry, "objectsid");
|
||||||
@ -980,12 +996,33 @@ class Ldap
|
|||||||
|
|
||||||
$filter = '('.$this->filter.'('.$userIdentifier.'='.$user.'))';
|
$filter = '('.$this->filter.'('.$userIdentifier.'='.$user.'))';
|
||||||
|
|
||||||
$this->result = @ldap_search($this->connection, $this->people, $filter);
|
$i = 0;
|
||||||
|
$searchDN = $this->people;
|
||||||
|
|
||||||
// Si pas de résultat on cherche dans le domaine
|
while ($i <= 2)
|
||||||
if (!$this->result) $this->result = @ldap_search($this->connection, $this->domain, $filter);
|
{
|
||||||
|
$this->result = @ldap_search($this->connection, $searchDN, $filter);
|
||||||
|
|
||||||
$result = @ldap_get_entries( $this->connection, $this->result);
|
if (!$this->result)
|
||||||
|
{
|
||||||
|
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = @ldap_get_entries( $this->connection, $this->result);
|
||||||
|
|
||||||
|
if (!$result)
|
||||||
|
{
|
||||||
|
// Si pas de résultat on cherche dans le domaine
|
||||||
|
$searchDN = $this->domain;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user