CAS-1429 Escape inputs into LDAP filter expressions.

This prevents LDAP injection attacks. Note this patch is only relevant for the 3.5.x branch since master is based on ldaptive, which properly handles character escaping.