Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Ldap search is hanging

by shawshankred (Sexton)
on Oct 14, 2008 at 21:31 UTC ( [id://717093]=perlquestion: print w/replies, xml ) Need Help??

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

I've written a code to perform a LDAP search from the DB and it works fine if the value is available in the DB. However if the value is not available then the ldap query hangs for ever. If the value is not found it should not hang but come back with not found.

Please check the code and let me know if I am doing anything wrong.

sub hss_search{ my ($hss_ip,$pw,$subscriber) = @_; $ldap = Net::LDAP->new($hss_ip, port=>$LDAP_PORT) or die "$@"; my $ldapMsg = $ldap->bind(dn => "administratorName=jambala,nodeNam +e=lenxks_rstnva_hss01", password =>$pw ); die $ldapMsg->error if $ldapMsg->is_error; #print "$ldapMsg->is_error \n"; $mesg = $ldap->search(filter => "HSS-PrivateUserID=sip:$subscriber +\@sprint.com", base => $LDAP_BASE, scope => "sub" ); @result = $mesg->entries; foreach $entry (@result) { #print "dn: " . $entry->dn() . "\n"; @attrs = $entry->attributes(); foreach $attr (@attrs) { if ($attr =~ /HSS-PrivateUserID/ ){ printf("\t%s: %s\n", $attr, $entry->get_value($attr)); } } } $mesg = $ldap->search(filter => "HSS-PublicIdValue=sip:$subscriber +\@sprint.com", base => $LDAP_BASE, scope => "sub" ); @result = $mesg->entries; foreach $entry (@result) { #print "dn: " . $entry->dn() . "\n"; @attrs = $entry->attributes(); foreach $attr (@attrs) { if ($attr eq 'HSS-PublicIdValue' ){ printf("\t%s: %s\n", $attr, $entry->get_value($attr)); } } } print "\n"; }

Replies are listed 'Best First'.
Re: Ldap search is hanging
by Anonymous Monk on Oct 14, 2008 at 21:52 UTC
    Try adding to search timelimit argument
    timelimit => N
    A timelimit that restricts the maximum time (in seconds) allowed for a search. A value of 0 (the default), means that no timelimit will be requested.
      I added timelimit argument in the search method but it still is taking 13 minutes to comeback with no entries. I thought that the argument name may be different so tried timeout => 10 and seconds => 10. All these did not work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://717093]
Approved by moritz
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found