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";
}