
December 21st, 2009, 10:19 PM
|
|
Registered User
|
|
Join Date: Dec 2009
Posts: 2
Time spent in forums: 23 m 26 sec
Reputation Power: 0
|
|
|
LDAP Perl showing only 500 entries.
Hello all,
I have an ldap with around 4 lakh entries. I want to view all of them done through perl. I ve written the below code but its showing only 500 entries. Am I doing anything wrong in this. Please help.
#!/usr/bin/perl
use Net::LDAP;
$ldap = Net::LDAP->new('localhost') or die "$@";
$mesg = $ldap->search(
base => "dc=dimdim,dc=com",
filter => "dc=*",
callback => \&callback,
);
if ( $mesg->code )
{
$errstr = $mesg->code;
print "Error code: $errstr\n";
$errstr = ldap_error_text($errstr);
print "$errstr\n";
}
sub callback
{
my ( $mesg, $entry) = @_;
if ( !defined($entry) )
{
print "No records found matching filter $match.\n"
if ($mesg->count == 0) ; # if mesg is not defined nothing will print.
return;
}
my $dn = $entry->dn; # Obtain DN of this entry
@attrs = $entry->attributes; # Obtain attributes for this entry.
foreach my $var (@attrs)
{
$attr = $entry->get_value( $var, asref => 1 );
if ( defined($attr) )
{
foreach my $value ( @$attr )
{
print "$var: $value\n"; # Print each value for the attribute.
}
}
}
$mesg->pop_entry;
} # End of callback subroutine
Thanks in advance....
|