lib/ldap: Call getConnection before bind

Looks more natural
This commit is contained in:
Eric Lippmann 2015-09-03 17:11:56 +02:00
parent 5651392ce7
commit 70a6157631
1 changed files with 3 additions and 3 deletions

View File

@ -538,9 +538,9 @@ class LdapConnection implements Selectable, Inspectable
*/
public function hasDn($dn)
{
$ds = $this->getConnection();
$this->bind();
$ds = $this->getConnection();
$result = ldap_read($ds, $dn, '(objectClass=*)', array('objectClass'));
return ldap_count_entries($ds, $result) > 0;
}
@ -556,9 +556,9 @@ class LdapConnection implements Selectable, Inspectable
*/
public function deleteRecursively($dn)
{
$ds = $this->getConnection();
$this->bind();
$ds = $this->getConnection();
$result = @ldap_list($ds, $dn, '(objectClass=*)', array('objectClass'));
if ($result === false) {
if (ldap_errno($ds) === self::LDAP_NO_SUCH_OBJECT) {
@ -591,9 +591,9 @@ class LdapConnection implements Selectable, Inspectable
*/
public function deleteDn($dn)
{
$ds = $this->getConnection();
$this->bind();
$ds = $this->getConnection();
$result = @ldap_delete($ds, $dn);
if ($result === false) {
if (ldap_errno($ds) === self::LDAP_NO_SUCH_OBJECT) {