changed ldapGetDN
This commit is contained in:
parent
d6dcd9c632
commit
6e290d2f7c
|
@ -681,11 +681,15 @@ function searchLDAP($suffix, $filter, $attributes) {
|
||||||
*
|
*
|
||||||
* @param String $dn DN
|
* @param String $dn DN
|
||||||
* @param array $attributes list of attributes to fetch
|
* @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
|
* @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;
|
$return = null;
|
||||||
$sr = @ldap_read($_SESSION['ldap']->server(), escapeDN($dn), 'objectClass=*', $attributes);
|
$sr = @ldap_read($handle, escapeDN($dn), 'objectClass=*', $attributes);
|
||||||
if ($sr) {
|
if ($sr) {
|
||||||
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
$entries = ldap_get_entries($_SESSION['ldap']->server(), $sr);
|
||||||
if ($entries) {
|
if ($entries) {
|
||||||
|
|
Loading…
Reference in New Issue