Thread

Posted on Fri Jun 6 01:58:05 2008 by mpc
Net::LDAP::FilterMatch can't match substring filters
A bug as been reported recently, and must have been present for quite some time (at least since v0.34) where a filter match will not return any results on a filter for substring.
As per the FilterMatch example, there are no matches found even if logic dictates that it should.
Example from FilterMatch POD
use Net::LDAP::Entry; use Net::LDAP::Filter; use Net::LDAP::FilterMatch; my $entry = new Net::LDAP::Entry; $entry->dn("cn=dummy entry"); $entry->add ( 'cn' => 'dummy entry', 'street' => [ '1 some road','nowhere' ] ); my @filters = (qw/(cn=dummy*) (ou=*) (&(cn=dummy*)(street=*road)) (&(cn=dummy*)(!(street=nowhere)))/); for (@filters) { my $filter = Net::LDAP::Filter->new($_); print $_,' : ', $filter->match($entry) ? 'match' : 'no match' ,"\n"; }

Unfortunatly, I do not have the luxury to wait for an official bug fix...
Does someone encountered the bug and fixed his own Filter.pm and/or FilterMatch.pm? If so, can you give me a hint please... I need to put something in production and I'm going in vacation...
Thanks,
MPC
Direct Responses: 8062 | Write a response
Posted on Thu Jun 12 14:01:58 2008 by bv in response to 8029
Re: Net::LDAP::FilterMatch can't match substring filters

I hardly know perl but I have experience with writing LDAP applications. You have to connect to a Directory or LDAP server first (and port if needed), bind anomalously (for searches) or bind with a dn and password (authenticated) for adds, updates, deletes, and searches. Searches needs to begin at a specific base dn (root or DN path) and then iterate through results and multi pal values. When finished with searches, adds, updates, and deletes, then you must unbind to the directory.

Check the documentation and examples at http://search.cpan.org/~gbarr/perl-ldap-0.36/lib/Net/LDAP.pod

If you need working examples of Delphi, winldap api, VB, TCL, or JAVA examples, I could look through my archives.

Brooks

Write a response