I'm attempting to query our campus enterprise directory LDAP server, and it's got one attribute that has multiple entries per person.

This is the code I'm using:

--------------------------------------------------------------------------
#!/usr/bin/perl

use Net::LDAPS qw(:all);
use Data::Dumper;

#username and password for new enterprise directory stuff
$iamlogin = '<redacted>';
$iampasswd = '<redacted>';
$searchBase = "ou=People,dc=eds,dc=arizona,dc=edu";
$searchFilter = "emplID=<redacted>";
# Connect to LDAPS port
$ldaps = new Net::LDAPS(
                '<redacted>',
                port => 636,
capath => '/usr/share/ssl/certs/') or die "Certs problem! Cannot connect!\n";

# Bind as NetID user
$mesg = $ldaps->bind(
        dn => "uid=$iamlogin,ou=App Users,dc=eds, dc=arizona, dc=edu",
        password => $iampasswd);
$mesg->code && die "Authentication failed: " . $mesg->error . "\n";

$mesg = $ldaps->search (  # perform a search
                               base => $searchBase,
                               filter => $searchFilter,
                     attrs => ["*", "+"]
                          );

                $mesg->code && die $mesg->error;


$nums = $mesg->count;

print Dumper($mesg);
exit;
--------------------------------------------------------------------------

This works, but returns only one instance of the desired attribute.

How do I get all of them?

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs


Reply via email to