Cmdr_Tofu has asked for the wisdom of the Perl Monks concerning the following question:


Greetings wise ones. We are trying as best we can to do our Windows 2000 user maintenance from UNIX using Net::LDAP. On my test Active Directory Server, this teensy LDAP search on the users works just fine. However, on the real server with the real list of users (>3000), my code bails with a "Sizelimit exceeded at ./simple.ad.pl line 26."

I did google this a little bit, and it appears the Sizelimit is an LDAP server setting and it can be adjusted with ntdsutil according to this, but I would prefer not to mess with the server settings if it's at all possible. With SQL I can do a LIMIT startnumber, endnumber on my SELECT statements and do multiple selects. Is there a practical way to do this with LDAP? I don't think using $ldap->search(sizelimit=>x) will cut it here.

Here is the code that I used:
#!/usr/local/perl/bin/perl -w use Net::LDAP; my $dc = 'my Active Directory's Servers Ip' my $ldap = Net::LDAP->new($dc) or die $@; my $rootdse = $ldap->root_dse(attrs=>['defaultNamingContext']); my $base = $rootdse->get_value('defaultNamingContext'); my $user = 'mySuperuser@ad.mydomain.com'; my $password = 'mySuperUserPassword'; my $rc = $ldap->bind ($user, password=>$password); die $rc->error if $rc->code; my $scope="subtree"; my $filter="(&(objectClass=organizationalPerson))"; my $attrs=['distinguishedName']; my $search=$ldap->search( base => $base, filter => $filter, attrs => $attrs ); die $search->error if $search->code; foreach my $entry ($search->entries) { $entry->dump; }

many thanks,

Rohit

Replies are listed 'Best First'.
Re: Net::LDAP Sizelimit exceeded error
by mojotoad (Monsignor) on Mar 20, 2003 at 23:07 UTC
    I hesitate to point out my bifurcating LDAP spider, because a) I have a newer version that is currently in storage (should have access later this week), and b) the code has not been personally tested in a while -- I no longer have a Microsoft LDAP server on which to test. So -- Net::LDAP might have changed and this might no longer work.

    However, once I regain access to the latest revision, I'll dust it off, hopefully find a test server, and go ahead and upload to CPAN. The name will most certainly change -- LDAPiranah was just a working name.

    Having said that, read part of my discussion with Graham Barr back in Oct, 1999.

    The mothballed project is here.

    Just keep in mind that the latest version will be dusted off and posted to CPAN once I can access a test server.

    Matt

      wow Net::LDAPiranah is cool! I will try it. I like the name too!
        what my problem is that when i run my program in perl on unix platform..i get the error message Sizelimit exceeded can any one help..thanks in advance