Hello all, I am writing a simple search script using Net::LDAP. The problem that I am having is with the filter.
When I execute my script I get the following error message: "Bad filter at line 15". The attribute that I am use a part of the filter is "employeetype" and the value is "consultant (pre-release)". This is a legitimate value. I am able to retrieve the entries with the command line tool "ldapsearch", but I am have trouble do it within my Net::LDAP script. My code is below. Thank you. use Net::LDAP qw(:all); use Net::LDAP::Util qw(ldap_error_text); my $ldconnect = Net::LDAP->new('host', port=>'389') || die "$@"; my $sr = $ldconnect->search( base=> 'O=com', scope=> 'sub', filter=> "( employeetype=consultant (pre-release) )" ); $sr->code && die "failed search: ", $sr->error ; foreach my $entry ($sr->entries) { $dn = $entry->dn; $cn = $entry->get_value('cn') || '-'; $emp = $entry->get_value('employeetype') || '-'; print "DN: $dn\n"; print "Common Name: $cn\n"; print "EMP Type: $emp\n"; }