跳到主要内容

1. LDAP 搜索过滤器定义

轻量目录访问协议 (LDAP) 搜索过滤器在 [1] 中的定义如下:

  Filter ::= CHOICE {
and [0] SET OF Filter,
or [1] SET OF Filter,
not [2] Filter,
equalityMatch [3] AttributeValueAssertion,
substrings [4] SubstringFilter,
greaterOrEqual [5] AttributeValueAssertion,
lessOrEqual [6] AttributeValueAssertion,
present [7] AttributeType,
approxMatch [8] AttributeValueAssertion
}

SubstringFilter ::= SEQUENCE {
type AttributeType,
SEQUENCE OF CHOICE {
initial [0] LDAPString,
any [1] LDAPString,
final [2] LDAPString
}
}



AttributeValueAssertion ::= SEQUENCE
attributeType AttributeType,
attributeValue AttributeValue
}

AttributeType ::= LDAPString

AttributeValue ::= OCTET STRING

LDAPString ::= OCTET STRING

上述 LDAPString 仅限于 IA5 字符集. AttributeType 是属性对象标识符的字符串表示, 采用点分 OID 格式 (例如 "2.5.4.10"), 或者是该属性较短的字符串名称 (例如 "organizationName" 或 "o"). AttributeValue OCTET STRING 采用 [2] 中定义的格式. Filter 使用 [3] 中定义的基本编码规则 (Basic Encoding Rules) 编码后经网络传输, 并采用了 [1] 中描述的简化处理.