Hi, I wrote a short script in Perl to query an LDAP directory (surprising, eh?). Here it is.
% my $connection = Net::LDAP->new($server) or % die "LDAP connect error: $@"; % my $result = $connection->bind($dn, 'password' => $password); % if ($result->code) { % die "Error binding to LDAP server: ".$result->error."\n"; % } % % my %args = ('base' => $base, 'filter' => $filter); % $args{'attrs} = $attrs if defined $attrs; % $result = $connection->search(%args); % % $connection->disconnect(); % % while (my $u = $result->shift_entry()) { % # Method 1, loop throughout entry's attributes. % printf "dn: %s\n", $u->dn(); % foreach my $a (sort $u->attributes('nooptions' => 1)) { % printf "%s: %s\n", $a, $u->get_value($a); % } % print "\n"; % % % # Method 2, ask explicitely for a few attributes. % printf "uid: %s\npassword: %s\n mail:%s\n\n", $u->get_value('uid'), % $u->get_value('userpassword'), $u->get_value('mail'); % } The problem is that I don't have the same attribute's value between method 1 and method 2. As a matter of fact, with method 2 attributes are somewhat "shuffled". Whether I explicitely provide a set of attributes in the search method or not is not relevant. Method 1: dn: CN=Jeremie LE-HEN,OU=ou,O=company cn: Jeremie LE-HEN givenname: Jeremie mail: [EMAIL PROTECTED] sn: LE-HEN uid: jeremie.le-hen userpassword: (Gp05VJcRvWB2+7mbtsEw) Method 2: uid: jeremie.le-hen password: [EMAIL PROTECTED] mail: (Gp05VJcRvWB2+7mbtsEw) When listing a great number of entries with method 2, one can see that mail and password values are often inverted, but sometimes the mail is correct but the password has some login-like value. I'm really puzzle by the behaviour. Any clue would be welcome. Thanks. Regards, -- Jeremie LE HEN [EMAIL PROTECTED]