From: Nicolas Boisselier Date: Wed, 13 Dec 2017 07:26:31 +0000 (+0000) Subject: lib/php/nb.php X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=c28f394f9aaa989495287d060c059110b47887a4;p=nb.git lib/php/nb.php --- diff --git a/lib/php/nb.php b/lib/php/nb.php index 33f012f2..847ddfe2 100644 --- a/lib/php/nb.php +++ b/lib/php/nb.php @@ -1090,7 +1090,40 @@ class NB { ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); $bind = ldap_bind($connect, $o['bind_dn'], $o['password']) or self::bye(">>Could not bind to ".$o['ldap_host']."<<"); - $read = ldap_search($connect, $o['base_dn'], $o['filter']) or self::bye(">>Unable to search ldap server<<"); + $read = ldap_search($connect, $o['base_dn'], $o['filter'], $o['attrs'], 0) or self::bye(">>Unable to search ldap server<<"); + + $info = []; + $i = 0; + $entry = ldap_first_entry($connect, $read); + do { + + $attributes = ldap_get_attributes($connect, $entry); + + for($j=0; $j<$attributes['count']; $j++) { + #if (!empty($o['attrs']) and !in_array($attributes[$j],$o['attrs'])) continue; + #debug($info[$i]); + #debug($attributes[$j]); + $values = ldap_get_values_len($connect, $entry,$attributes[$j]); + unset($values['count']); + if (false) for ($v=0; $v