Fix: ajout debug

This commit is contained in:
Regis Houssin 2007-06-02 11:30:06 +00:00
parent 6cd2717124
commit 665aa79a4a

View File

@ -872,41 +872,40 @@ class Ldap
* ldapuser. le login de l'utilisateur * ldapuser. le login de l'utilisateur
* Indispensable pour Active Directory * Indispensable pour Active Directory
*/ */
function getObjectSid($ldapUser) function getObjectSid($ldapUser)
{ {
$criteria = '('.$this->getUserIdentifier().'='.$ldapUser.')'; $criteria = '('.$this->getUserIdentifier().'='.$ldapUser.')';
$justthese = array("objectsid"); $justthese = array("objectsid");
// if the directory is AD, then bind first with the search user first // if the directory is AD, then bind first with the search user first
if ($this->serverType == "activedirectory") if ($this->serverType == "activedirectory")
{ {
$this->bindauth($this->searchUser, $this->searchPassword); $this->bindauth($this->searchUser, $this->searchPassword);
} }
$ldapSearchResult = @ldap_search($this->connection, $this->people, $criteria, $justthese); $ldapSearchResult = @ldap_search($this->connection, $this->people, $criteria, $justthese);
// Si pas de résultat on cherche dans le domaine // Si pas de résultat on cherche dans le domaine
if (!$ldapSearchResult) $ldapSearchResult = @ldap_search($this->connection, $this->domain, $criteria, $justthese); if (!$ldapSearchResult) $ldapSearchResult = @ldap_search($this->connection, $this->domain, $criteria, $justthese);
if (!$ldapSearchResult) if (!$ldapSearchResult)
{ {
$this->error = ldap_errno($this->connection)." ".ldap_error($this->connection); $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
return -1; return -1;
} }
$entry = ldap_first_entry($this->connection, $ldapSearchResult); $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");
$SIDText = $this->binSIDtoText($ldapBinary[0]); $SIDText = $this->binSIDtoText($ldapBinary[0]);
return $SIDText; return $SIDText;
//return $ldapBinary; }
} else
else {
{ $this->error = ldap_errno($this->connection)." ".ldap_error($this->connection);
return '?'; return '?';
} }
} }
/** /**