"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

Reply via email to