Hi guys,
I'd like to start automating a few things on my LDAP server with Perl
but I haven't been able to successfully log in and search yet. In LDAP
Administrator, my base DN is dc=lam and my username is cn=root,dc=lam.
What am I doing wrong to grab a set of entries similar to
cn=hm-6YOC8298,ou=homes,dc=lam ? Thanks a lot!
#!/usr/bin/perl
use Net::LDAP;
my $ad = Net::LDAP->new("authdev") or die "$0";
my $err = $ad->bind(dn=>"cn=root,dc=lam", password=>"xxx") . "\n"; #
$err prints "Net::LDAP::Bind=HASH(0x807a16c)"
my $searchbase = 'ou=homes,dc=lam';
my $filter = "(cn=*)";
my $attrs = "mail";
my $results = $ad->search(base=>$searchbase,filter=>$filter,attrs=>$attrs);
my $count = $results->count;
print "Total entries returned: $count\n";
$ad->unbind;