From: Eric N. <eri...@di...> - 2003-02-14 15:54:08
|
Actually Exchange 5.5 creates a single thread process for the search. If the search results is over say 10,000 Exchange will drive up the memory on the search, run out of resources and the search will die. If your not careful other Exchange services will shut down as a result. I would suggest setting your limit to something reasonable (Say 100, NOT zero) and use Net::LDAP::Control::Paged; set at 100 per page. This trims the thread to 100 records and saves resources. I've returned as many as 160,000 objects with this method. Eric www.dir-wizards.com Hirmke Michael wrote: >Hi, > >I try to get all smtp addresses from an Exchange 5.5 directory using >Perl::LDAP 0.2701. The search, though, either hangs around forever or >returns after about ten minutes without giving any results (I suspect >this is the idle disconnect time configured in Exchange). > >System is SuSE Linux 8.1 with kernel 2.4.19 and Perl::LDAP 0.2701. >Btw. the same query with ldapsearch from the OpenLDAP package works as >expected. > >The maximum result limit in the Exchange LDAP protocol ist configured to >250000 and we have about 150000 entries in our directory. > >Here is the according code snippet: > >---------------------------< schnipp schnapp >-------------------------- >#!/usr/bin/perl -w > >use strict; >use Net::LDAP 0.27; >use LibUtil; > > my( $ret_val ); > my( $LDAPSRV ) = "my.exchange.machine"; > my( $LDAPPORT ) = 389; > my( $LDAPVER ) = 3; > my( $LDAPDBG ) = 0; > my( $AUTHDN ) = "cn=myaccount,cn=mydomain,cn=Admin"; > my( $AUTHPASS ) = "mypasswd"; > my( $sBase ) = "o=myexchangeorg"; > my( $sFilter ) = '(objectClass=*)'; > my( @lAttrs, %hSearch, $oLDAP, $lohEntries ); > > $sFilter = &Latin1UTF8( $sFilter ) if( $sFilter && $LDAPVER >= 3 ); > @lAttrs = ( "rfc822Mailbox", "otherMailbox", "Hide-From-Address-Book", "Is-Deleted" ); > > $oLDAP = new Net::LDAP( $LDAPSRV, > version => $LDAPVER, > port => $LDAPPORT, > debug => $LDAPDBG, > ) or die $@; > print "new ok\n"; > $ret_val = $oLDAP->bind( $AUTHDN, > version => $LDAPVER, > password => $AUTHPASS > ); > die ldap_error_text( $ret_val->code ) if( $ret_val->code ); > print "bind ok\n"; > > %hSearch = ( > scope => "sub", > base => $sBase, > ); > $hSearch{ "filter" } = $sFilter if( $sFilter ); > $hSearch{ "attrs" } = [ @lAttrs ] if( @lAttrs ); > > $lohEntries = $oLDAP->search( %hSearch ) || die $@; > print "search ok\n"; > > print "hits: ", $lohEntries->count, "\n"; > > $oLDAP->unbind; >---------------------------< schnipp schnapp >-------------------------- > > >I can see in the Exchange Servers log that the client has connected and it >even tells me, what attributes the script had requested. But that is the >last log file entry before disconnecting. > > > >Any idea? > >TIA. > >Bye. >Michael. > > >------------------------------------------------------- >This SF.NET email is sponsored by: FREE SSL Guide from Thawte >are you planning your Web Server Security? Click here to get a FREE >Thawte SSL guide and find the answers to all your SSL security issues. >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en > > |