From: Chris R. <Chr...@me...> - 2000-07-24 11:55:11
|
On Mon, 24 Jul 2000 12:34:58 BST, Graham Barr wrote: > ----- Forwarded message from "Mouawad, Naji" <NAJ...@sa...> ----- > > From: "Mouawad, Naji" <NAJ...@sa...> > To: "'gb...@po...'" <gb...@po...> > Cc: "'Steve Misrack'" <st...@es...> > Subject: Bug in Net::LDAP? > Date: Fri, 21 Jul 2000 14:18:18 -0700 > X-Mailer: Internet Mail Service (5.5.2650.21) > > Graham: > Consider the following code: > > ## ############### BEGIN PERL CODE ####################### > #!/usr/bin/perl > use strict; > $| = 1; > use Net::LDAP; > sub Get_Info { > my $Name = shift; > my $ldap = Net::LDAP->new('server_name'); > $ldap->bind; > my $mesg = $ldap->search(base => 'o=The_Word', > filter=>'ou=' . $Name); > foreach my $entry ($mesg->all_entries) { $entry->dump;} > $ldap->unbind; > } ## Get_Info > > my $good_name = 'Test Company 3'; > my $bad_name = "International Technegroup, Inc. (ITI)"; > print "Searching for $good_name\n"; > Get_Info($good_name); > > print "\nSearching for $bad_name\n"; > Get_Info($bad_name); > > ### #################### END OF PERL CODE > > The script hangs when it attempts to search for the bad name. I traced it > down to > parenthesis. Even when the parenthesis are escaped, the problem persists. > > Is this a bug or am I not using the package as it was intended to be used? > > Naji. I think you are misusing the package. The value for the filter must be a search filter as defined by RFC 2254 (or RFC 1960 if you are using LDAPv2). Briefly, the whole expression must be surrounded by parens, and certain characters in the matched value need escaping. So the second filter should really be: (ou=International Technegroup, Inc. \28ITI\29) Cheers, Chris |