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

"Dieter Kluenter" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.ldap
Message-ID <[email protected]>
"A. Farber" <[email protected]> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.