After an upgrade, this LDAP Query for AD Users suddenly fails:
(&(objectCategory=Person)(sAMAccountName=*)(!(sAMAccountName=SM*)(!(mail=*mailfdqn.eu*))))
with:
Test retrieve user : Failed
org.springframework.ldap.InvalidSearchFilterException: Filter (!) cannot be followed by more than one filters; nested exception is javax.naming.directory.InvalidSearchFilterException: Filter (!) cannot be followed by more than one filters; remaining name 'ou=TheCompanyName,ou=Microsoft Exchange Hosted Organizations,dc=mshosting,dc=local'
After tests, it seems that negations/not's does not work, as in:
(&(objectCategory=Person)(sAMAccountName=*)(mail=*mailfdqn.dk)(!(sAMAccountName=SM*))
But this works:
(&(objectCategory=Person)(sAMAccountName=*)(mail=*mailfdqn.dk))
But I need the (!(sAMAccountName=SM*) to limit the amount of users sync'ed