make_filter: cope with filters that are already parenthesized
Treat filter elements correctly that may be more complex filters
themselves; e.g. '(&(sn=Doe)(givenname=John))'
--- a/shelldap Sat Mar 05 22:13:27 2011 +0100
+++ b/shelldap Sat Mar 05 22:22:47 2011 +0100
@@ -760,9 +760,9 @@
return unless scalar @$globs;
my $filter;
- $filter = join '', map { "($_)" } @$globs;
- $filter = '(|' . $filter . ')' if scalar @$globs > 1;
- $filter = Net::LDAP::Filter->new( $filter );
+ $filter = join('', map { (/^\(.*\)$/o) ? $_ : "($_)" } @$globs);
+ $filter = '(|' . $filter . ')' if (scalar(@$globs) > 1);
+ $filter = Net::LDAP::Filter->new($filter);
if ( $filter ) {
$self->debug('Filter parsed as: ' . $filter->as_string() . "\n");