diff --git a/plugins/password/drivers/ldap.php b/plugins/password/drivers/ldap.php index 46c783587..06c36df27 100644 --- a/plugins/password/drivers/ldap.php +++ b/plugins/password/drivers/ldap.php @@ -187,12 +187,14 @@ class rcube_ldap_password ); $result = $ldap->search($base, $filter, $options); - $ldap->done(); if (is_a($result, 'PEAR_Error') || ($result->count() != 1)) { - return ''; + $dn = ''; + } else { + $dn = $result->current()->dn(); } - - return $result->current()->dn(); + $ldap->done(); + + return $dn; } /**