develooper Front page | perl.ldap | Postings from October 2008

Re: Bad filter in Active Directory: (!company=mycompany)

Thread Previous
From:
Dieter Kluenter
Date:
October 24, 2008 10:36
Subject:
Re: Bad filter in Active Directory: (!company=mycompany)
"A. Farber" <Alexander.Farber@gmail.com> writes:

> Hello,
>
> I've written a short script to prepend "ext-" to mail addresses
> of all external colleagues in Microsoft Active Directory:
>
>     filter  => '(&(objectCategory=Person)(objectClass=User))',
> ....
>     $mail = "ext-$mail"
>         if $entry->get_value('company') !~ /mycompany/i
>             && $mail !~ /^ext-/;
>
> For better performance I'd like to move
> the company test to the search filter:
>
>     filter  =>
> '(&(objectCategory=Person)(objectClass=User)(!company=mycompany))',
>
> Unfortunately it fails with: Bad filter at ....
>
> If I remove "!" it works ok. If I try that filter with dsquery:
>
> dsquery * domainroot -filter "(&(objectCategory=Person)
> (objectClass=User)(!company=mycompany))

Your filter is wrong, ((objectclass=user)(!(company=mycompany)))
RFC-4515, section 3 and 4.

-Dieter

-- 
Dieter Klünter | Systemberatung
http://www.dpunkt.de/buecher/2104.html
GPG Key ID:8EF7B6C6
53°08'09,95"N
10°08'02,42"E

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About