I'm trying to read a list of values from a file (single entry per line) and use the value in a ldap-search query. When I try the script below it just hangs at the search line (used the perl -d option), but if I set the $domain variable inside the script by uncommenting the appropriate line it works fine. It's driving me mental, can anyone tell me where I'm going wrong?
I see it bind ok, then there's nothing else on the ldap server until I terminate the script. When passed a value resulting from a previous process, LDAP search hangs. No error no exception, it just hangs. After a long time, I get a "do_ypcall: clnt_call: RPC: Timed out" error. If I hardcode the value, it works fine. I printed the value of the variable to look for non-printable characters, nothing. I also made sure it was not a tainting problem. Any idea anybody ? (perl 5.8, and perl-ldap 0.31) use Net::LDAP; $ldap_server = 'ldapserver'; $ldap_binddn = 'cn=Manager,dc=myldap,dc=net'; $ldap_bindpw = 'secret'; $ldap_port = 389; $ldap_version = 3; # Create LDAP connection $ldap = Net::LDAP->new ($ldap_server, port => $ldap_port, version => $ldap_version); $result = $ldap->bind($ldap_binddn, password => $ldap_bindpw); die $result->error() if $result->code(); open IMPORT, "import.csv" || die "Can\'t open import file\n"; while (<IMPORT>) { chomp $_; $domain = $_; #$domain = "testdomain.com"; # check $domain object exists in ou=domains $msg = $ldap->search( base=>"ou=domains,dc=myldap,dc=net", filter=>"(associatedDomain=$domain)", ); $msg->code && die $msg->error; print $msg->count() . "\n"; } # while IMPORT $ldap->unbind(); > ____________________________________________ > NOKIA > Jean-François Larocque > SCM Administrator > NOKIA, INC. > 12278 Scripps Summit Drive phone: 858 831 1053 > San Diego, CA 92131 USA mobile: 619 884 4723 > Fax : 858 831 4165 > [EMAIL PROTECTED] > ____________________________________________ >