LDAP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesLDAP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 21st, 2009, 10:19 PM
karthiksharu karthiksharu is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2009
Posts: 2 karthiksharu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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....

Reply With Quote
  #2  
Old January 19th, 2010, 05:56 PM
ldapswandog ldapswandog is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Location: Charlotte, NC
Posts: 111 ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level)ldapswandog User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 18 m
Reputation Power: 8
You have your filter set to "dc=*" so I'm wondering if you actually have 500 domain context entries defined? If the filter in the example is not the one your using and you are actually using a filter like "objectclass=*" and are still getting just 500 entries back then you need to check the RETURN sizelimit for the directory. it may be restricting the number of entries returned from a search to 500.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesLDAP Programming > LDAP Perl showing only 500 entries.

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap