From 6e290d2f7ca538aedcc6a07bfc9b1313530892b4 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Fri, 30 Nov 2012 19:19:56 +0000 Subject: [PATCH] changed ldapGetDN --- lam/lib/account.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lam/lib/account.inc b/lam/lib/account.inc index 081f83ff..9c4ccd6e 100644 --- a/lam/lib/account.inc +++ b/lam/lib/account.inc @@ -681,11 +681,15 @@ function searchLDAP($suffix, $filter, $attributes) { * * @param String $dn DN * @param array $attributes list of attributes to fetch + * @param handle $handle LDAP handle (optional for admin interface pages) * @return array attributes or null if not found */ -function ldapGetDN($dn, $attributes = array('dn')) { +function ldapGetDN($dn, $attributes = array('dn'), $handle = null) { + if ($handle == null) { + $handle = $_SESSION['ldap']->server(); + } $return = null; - $sr = @ldap_read($_SESSION['ldap']->server(), escapeDN($dn), 'objectClass=*', $attributes); + $sr = @ldap_read($handle, escapeDN($dn), 'objectClass=*', $attributes); if ($sr) { $entries = ldap_get_entries($_SESSION['ldap']->server(), $sr); if ($entries) {