ietf-corpus

rfc-2254

The String Representation of LDAP Search Filters

T. Howes
date1997-12 streamIETF areaapp wgasid statusPROPOSED STANDARD pages8 canonicalhttps://www.rfc-editor.org/rfc/rfc2254 doi10.17487/RFC2254 errataview
This document defines a human-readable string format for representing LDAP search filters. [STANDARDS-TRACK]

obsoleted by

obsoletes

updated by

Extracted elements (17)

design-rationale §4

Although both the substring and present grammar productions can produce the 'attr=*' construct, this construct is reserved solely to denote a presence filter, not a substring filter with empty components.

ldap

design-rationale §4

The backslash escaping mechanism was chosen because it eliminates filter-parsing ambiguities and allows any LDAP filter to be represented as a NUL-terminated string. Other non-printing characters may also be escaped using the same mechanism.

ldap

design-rationale §4

The filter format uses prefix notation (operator before operands, e.g., '(&(a=1)(b=2))') rather than infix, which is consistent with LDAP's ASN.1 structure and simplifies unambiguous recursive parsing.

ldap

interoperability-note §1

The IESG warns that until mandatory authentication mechanisms are standardized, clients and servers implementing LDAP update functionality are UNLIKELY TO INTEROPERATE, or MAY INTEROPERATE ONLY IF AUTHENTICATION IS REDUCED TO AN UNACCEPTABLY WEAK LEVEL.

ldap, security

interoperability-note §2

This document replaces RFC 1960, extending the string LDAP filter definition to include support for LDAPv3 extended match filters and to cover the full range of possible LDAP search filters.

ldap

normative-requirement §4 MUST

Characters *, (, ), \, and NUL (ASCII 0x2a, 0x28, 0x29, 0x5c, 0x00) MUST be encoded as a backslash '\' followed by the two hexadecimal digits representing the character's ASCII value when they appear in a filter value.

ldap

normative-requirement §4 MAY

The case of the two hexadecimal digits used in the escape sequence is not significant, meaning both '\2a' and '\2A' are valid representations of the '*' character.

ldap

protocol-element §3

LDAPString is defined as an OCTET STRING limited to the UTF-8 encoding of the ISO 10646 character set. AttributeDescription, MatchingRuleID, and similar string types are all LDAPString instances.

ldap

protocol-element §3

MatchingRuleAssertion includes optional matchingRule [1] MatchingRuleID, optional type [2] AttributeDescription, required matchValue [3] AssertionValue, and dnAttributes [4] BOOLEAN DEFAULT FALSE. This supports extensible matching against named matching rules.

ldap

protocol-element §3

SubstringFilter is a SEQUENCE with an AttributeDescription type and a SEQUENCE OF CHOICE containing initial [0], any [1], and final [2] LDAPString components. This structure allows prefix, infix, and suffix substring matching.

ldap

protocol-element §5

The extensible match ':dn' notation indicates that the attributes of an entry's distinguished name should be considered part of the entry when evaluating the match, as illustrated by '(sn:dn:2.4.6.8.10:=Barney Rubble)'.

ldap

protocol-element §3

The LDAP search Filter is defined as an ASN.1 CHOICE encompassing ten filter types: and, or, not, equalityMatch, substrings, greaterOrEqual, lessOrEqual, present, approxMatch, and extensibleMatch. This covers the full range of LDAPv3 search filter semantics.

ldap

protocol-element §5

When no attr is specified in an extensible filter (e.g., '(:dn:2.4.6.8.10:=Dino)'), the filter applies to any attribute supporting the given matching rule, including those in DN components if ':dn' is present.

ldap

security-consideration §6

While the string representation itself has no known security implications, LDAP search filters are interpreted by servers to select entries from which data is retrieved. LDAP servers should take care to protect the data they maintain from unauthorized access.

ldap, security

wire-format §4

Extensible match filters are encoded as 'attr [":dn"] [":" matchingrule] ":=" value' or '[":dn"] ":" matchingrule ":=" value'. The ':dn' flag causes DN attributes to be considered when evaluating the match.

ldap

wire-format §4

Simple filter items take the form 'attr filtertype value' where filtertype is '=' (equal), '~=' (approx), '>=' (greater), or '<=' (less). Presence filters use 'attr=*' and substring filters use 'attr=[initial]*[any]*[final]'.

ldap

wire-format §4

The string representation uses prefix parenthesized notation defined by an ABNF grammar. A filter is '(' filtercomp ')' where filtercomp is one of: '&' filterlist (AND), '|' filterlist (OR), '!' filter (NOT), or an item (simple, present, substring, extensible).

ldap