Skip to content

Commit

Permalink
fixed getEntry()
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/Net_LDAP/trunk@145012 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
Jan Wagner committed Nov 28, 2003
1 parent 2efd9a0 commit 09a2890
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions LDAP.php
Expand Up @@ -592,17 +592,16 @@ function dnExists($dn)
*/ */
function &getEntry($dn) function &getEntry($dn)
{ {
$base = $dn; $result = $this->search($dn, '(objectClass=*)', array('scope' => 'base', 'attributes' => null));
$filter = '(objectclass=*)'; if (Net_LDAP::isError($result)) {
$result = @ldap_list($this->_link, $base, $filter, array(), 1, 1); return $result;
if (ldap_count_entries($result) > 0) {
$elink = @ldap_first_entry($this->_link, $this->result);
return new Net_LDAP_Entry($this->_link,
@ldap_get_dn($this->_link, $elink),
@ldap_get_attributes($this->_link, $elink));
} }
return false; $entry = $result->shift_entry();
} if (false == $entry) {
return $this->raiseError('Could not fetch entry');
}
return $entry;
}




/** /**
Expand Down

0 comments on commit 09a2890

Please sign in to comment.