pingidentity / ldapsdk

UnboundID LDAP SDK for Java
Other
334 stars 81 forks source link

LDAP_MATCHING_RULE_IN_CHAIN extended match operator #90

Open Natipapi opened 4 years ago

Natipapi commented 4 years ago

I recently changed my filters from textual, prone to special characters filters, i.e. (memberOf:1.2.840.113556.1.4.1941:=" + dn + ") to: Filter.createEqualityFilter("memberOf:1.2.840.113556.1.4.1941:", dn1) But the control is ignored on the filter. I couldn't find a proper "pre defined" control on LdapSDK. I guess I'm missing something?

dirmgr commented 4 years ago

The problem is that you're trying to create an extensible matching filter, but you're using a method to create an equality filter. Those are two completely different types of filters, so the server isn't getting the correct request. Instead of using:

Filter.createEqualityFilter("memberOf:1.2.840.113556.1.4.1941:", dn1)

you should use:

Filter.createExtensibleMatchFilter("memberOf", "1.2.840.113556.1.4.1941", false, dn1)

And by the way, "1.2.840.113556.1.4.1941" references a matching rule rather than a control.