| Extracted from Pike v7.8 release 866 at 2016-04-05.

[Top]
Protocols
Protocols.LDAP

# Method Protocols.LDAP.make_filter()

Method make_filter

  `object make_filter(string filter, void|int ldap_version)`

Description

  Parses an LDAP filter string into an ASN1 object tree that can be given to Protocols.LDAP.search .

  Using this function instead of giving the filter string directly to the search function has two advantages: This function provides better error reports for syntax errors, and the same object tree can be used repeatedly to avoid reparsing the filter string.

Parameter `filter`

  The filter to parse, according to the syntax specified in RFC 2254. The syntax is extended a bit to allow and ignore whitespace everywhere except inside and next to the filter values.

Parameter `ldap_version`

  LDAP protocol version to make the filter for. This controls what syntaxes are allowed depending on the protocol version. Also, if the protocol is `3` or later then full Unicode string literals are supported. The default is the latest supported version.

Returns

  An ASN1 object tree representing the filter.

Throws

  FilterError is thrown if there's a syntax error in the filter.