LDAP: improve compilation of filters

please review @bantu @karlitschek @DeepDiver1975