RFC 4511
Lightweight Directory Access Protocol (LDAP): The Protocol
Lightweight Directory Access Protocol (LDAP): The Protocol ๐
Okay bestie, this is RFC 4511, from the Network Working Group ๐ง. It's a Standards Track doc, so it's the real deal, not just an opinion piece. It was written by J. Sermersheim, Ed. at Novell, Inc. and it's dated June 2006 ๐ . It obsoletes RFC 2251, RFC 2830, and RFC 3771 ๐ . Those older docs are kind of retired now, so this one is the one to read.
Status of This Memo โจ
This doc specifies an internet standards track protocol for the internet community, and it's asking for discussion and suggestions for improvements ๐ซถ. If you want to know where this protocol stands, check the current edition of "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited ๐ธ.
Copyright Notice ๐
Copyright (C) The Internet Society (2006).
Abstract ๐ฆ
So this doc describes the protocol elements of the Lightweight Directory Access Protocol (LDAP), including what they mean and how they're encoded ๐. LDAP gives you access to distributed directory services that behave according to X.500 data and service models ๐ฅ. The protocol elements are based on the ones in the X.500 Directory Access Protocol (DAP) ๐.
Table of Contents ๐
1. Introduction ....................................................3
1.1. Relationship to Other LDAP Specifications ..................3
2. Conventions .....................................................3
3. Protocol Model ..................................................4
3.1. Operation and LDAP Message Layer Relationship ..............5
4. Elements of Protocol ............................................5
4.1. Common Elements ............................................5
4.1.1. Message Envelope ....................................6
4.1.2. String Types ........................................7
4.1.3. Distinguished Name and Relative Distinguished Name ..8
4.1.4. Attribute Descriptions ..............................8
4.1.5. Attribute Value .....................................8
4.1.6. Attribute Value Assertion ...........................9
4.1.7. Attribute and PartialAttribute ......................9
4.1.8. Matching Rule Identifier ...........................10
4.1.9. Result Message .....................................10
4.1.10. Referral ..........................................12
4.1.11. Controls ..........................................14
4.2. Bind Operation ............................................16
4.2.1. Processing of the Bind Request .....................17
4.2.2. Bind Response ......................................18
4.3. Unbind Operation ..........................................18
4.4. Unsolicited Notification ..................................19
4.4.1. Notice of Disconnection ............................19
4.5. Search Operation ..........................................20
4.5.1. Search Request .....................................20
4.5.2. Search Result ......................................27
4.5.3. Continuation References in the Search Result .......28
4.6. Modify Operation ..........................................31
4.7. Add Operation .............................................33
4.8. Delete Operation ..........................................34
4.9. Modify DN Operation .......................................34
4.10. Compare Operation ........................................36
4.11. Abandon Operation ........................................36
4.12. Extended Operation .......................................37
4.13. IntermediateResponse Message .............................39
4.13.1. Usage with LDAP ExtendedRequest and
ExtendedResponse ..................................40
4.13.2. Usage with LDAP Request Controls ..................40
4.14. StartTLS Operation .......................................40
4.14.1. StartTLS Request ..................................40
4.14.2. StartTLS Response .................................41
4.14.3. Removal of the TLS Layer ..........................41
5. Protocol Encoding, Connection, and Transfer ....................42
5.1. Protocol Encoding .........................................42
5.2. Transmission Control Protocol (TCP) .......................43
5.3. Termination of the LDAP session ...........................43
6. Security Considerations ........................................43
7. Acknowledgements ...............................................45
8. Normative References ...........................................46
9. Informative References .........................................48
10. IANA Considerations ...........................................48
Appendix A. LDAP Result Codes .....................................49
A.1. Non-Error Result Codes ....................................49
A.2. Result Codes ..............................................49
Appendix B. Complete ASN.1 Definition .............................54
Appendix C. Changes ...............................................60
C.1. Changes Made to RFC 2251 ..................................60
C.2. Changes Made to RFC 2830 ..................................66
C.3. Changes Made to RFC 3771 ..................................66
1. Introduction ๐งโโ๏ธ
So the Directory is "a collection of open systems cooperating to provide directory services" [X.500] ๐. A directory user can be a human or some other entity, and they get to the Directory through a client, also called a Directory User Agent (DUA) ๐ธ. That client talks to one or more servers, also called Directory System Agents (DSA), for the user. Clients and servers talk to each other using a directory access protocol โจ.
This doc breaks down the protocol elements of LDAP and what they mean ๐ฆ. After it covers the elements, it explains how they get encoded and transferred ๐ซถ.
1.1. Relationship to Other LDAP Specifications ๐
This doc is a core part of the LDAP Technical Specification [RFC4510]. That one obsoletes the old LDAP technical spec, RFC 3377, completely ๐.
Together with [RFC4510], [RFC4513], and [RFC4512], this doc obsoletes RFC 2251 in its entirety ๐. Section 3.3 is obsoleted by [RFC4510]. Sections 4.2.1 (portions) and 4.2.2 are obsoleted by [RFC4513]. Sections 3.2, 3.4, 4.1.3 (last paragraph), 4.1.4, 4.1.5, 4.1.5.1, 4.1.9 (last paragraph), 5.1, 6.1, and 6.2 (last paragraph) are obsoleted by [RFC4512]. Whatever's left of RFC 2251 is obsoleted by this doc. Appendix C.1 sums up the substantive changes in that leftover part ๐ฅ.
This doc also obsoletes Sections 2 and 4 of RFC 2830 ๐. The rest of RFC 2830 is obsoleted by [RFC4513], and Appendix C.2 covers the substantive changes to the remaining sections ๐.
This doc also obsoletes RFC 3771 in entirety ๐.
2. Conventions โญ
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", and "MAY" in this document are to be interpreted as described in [RFC2119] ๐ง .
Character names in this doc use the notation for code points and names from the Unicode Standard [Unicode] ๐ธ. For example, the letter "a" can be written as either <U+0061> or <LATIN SMALL LETTER A> ๐ค.
Note: you can find a glossary of Unicode terms in [Glossary]. Info on the Unicode character encoding model is in [CharModel] ๐.
The term "transport connection" means the underlying transport services that carry the protocol exchange, plus any associations those services set up ๐.
The term "TLS layer" means Transport Layer Security (TLS) services used for security, plus any associations those services set up ๐.
The term "SASL layer" means Simply Authentication and Security Layer (SASL) services used for security, plus any associations those services set up ๐ก๏ธ.
The term "LDAP message layer" means the LDAP Message Protocol Data Unit (PDU) services used for directory services, plus any associations those services set up ๐จ.
The term "LDAP session" means all of those combined services (transport connection, TLS layer, SASL layer, LDAP message layer) together with their associations ๐ฆ.
Check out the table in Section 5 for a visual of these four terms ๐.
3. Protocol Model ๐งฉ
The general model here is clients doing protocol operations against servers ๐ . The client sends a protocol request to a server, describing the operation it wants done. The server is then in charge of doing the necessary operation(s) in the Directory ๐ซถ. When an operation finishes, the server usually sends back a response with the right data for the requesting client ๐.
Protocol operations are generally independent of one another ๐. Each operation is handled as an atomic action, so the directory stays in a consistent state โจ.
Servers are required to return responses whenever the protocol defines them, but nobody's forcing clients or servers to be synchronous ๐. Requests and responses for multiple operations can generally be swapped between a client and server in any order ๐ฅ. If you need synchronous behavior, client applications can control that themselves ๐ง.
The core protocol operations in this doc can be mapped to a subset of the X.500 (1993) Directory Abstract Service [X.511] ๐. But LDAP operations and X.500 Directory Access Protocol (DAP) operations don't map one-to-one ๐. Server implementations that act as a gateway to X.500 directories may need to make multiple DAP requests to handle a single LDAP request ๐ฆ.
3.1. Operation and LDAP Message Layer Relationship ๐
Protocol operations are exchanged at the LDAP message layer ๐จ. When the transport connection closes, any operations still pending at the LDAP message layer are either abandoned (if possible) or completed without sending the response (if abandoning them isn't possible) โญ. Also, when the transport connection closes, the client MUST NOT assume that any uncompleted update operations have succeeded or failed ๐.
4. Elements of Protocol ๐
The protocol is described using Abstract Syntax Notation One ([ASN.1]), and it's transferred using a subset of ASN.1 Basic Encoding Rules ([BER]) ๐ง. Section 5 explains how the protocol elements get encoded and transferred ๐ซถ.
To leave room for future extensions, extensibility is implied wherever ASN.1 allows it. In other words, sequence, set, choice, and enumerated types are extensible ๐ธ. Ellipses (...) are also included in ASN.1 types that are explicitly extensible, as covered in [RFC4520] โจ. Because of this implied extensibility, clients and servers MUST (unless otherwise specified) ignore trailing SEQUENCE components whose tags they don't recognize ๐.
Changes to the protocol made any other way than through these extension mechanisms need a different version number ๐ข. A client tells the server which version it's using in the BindRequest, which is described in Section 4.2 ๐. If a client hasn't sent a Bind, the server MUST assume the client is using version 3 or later ๐.
Clients can try to figure out which protocol versions a server supports by reading the 'supportedLDAPVersion' attribute from the root DSE (DSA-Specific Entry) [RFC4512] ๐.
4.1. Common Elements
okay so this bit covers the LDAPMessage envelope PDU format ๐ฆ plus the data type definitions that every protocol operation relies on ๐
4.1.1. Message Envelope
bestie, every protocol operation gets wrapped in the same envelope, called the LDAPMessage ๐ it's defined like this:
LDAPMessage ::= SEQUENCE {
messageID MessageID,
protocolOp CHOICE {
bindRequest BindRequest,
bindResponse BindResponse,
unbindRequest UnbindRequest,
searchRequest SearchRequest,
searchResEntry SearchResultEntry,
searchResDone SearchResultDone,
searchResRef SearchResultReference,
modifyRequest ModifyRequest,
modifyResponse ModifyResponse,
addRequest AddRequest,
addResponse AddResponse,
delRequest DelRequest,
delResponse DelResponse,
modDNRequest ModifyDNRequest,
modDNResponse ModifyDNResponse,
compareRequest CompareRequest,
compareResponse CompareResponse,
abandonRequest AbandonRequest,
extendedReq ExtendedRequest,
extendedResp ExtendedResponse,
...,
intermediateResponse IntermediateResponse },
controls [0] Controls OPTIONAL }
MessageID ::= INTEGER (0 .. maxInt)
maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
The ASN.1 type Controls is defined in Section 4.1.11.
The whole job of the LDAPMessage is to be an envelope holding the common fields that every exchange needs โจ right now, the only common fields are the messageID and the controls ๐ซถ
If the server receives an LDAPMessage from the client where the LDAPMessage SEQUENCE tag can't be recognized, the messageID can't be parsed, the tag of the protocolOp isn't recognized as a request, or the encoding structures or lengths of data fields turn out to be incorrect, then the server SHOULD return the Notice of Disconnection described in Section 4.4.1, with the resultCode set to protocolError, and MUST immediately terminate the LDAP session as described in Section 5.3 ๐
In other cases where the client or server can't parse an LDAP PDU, it SHOULD abruptly terminate the LDAP session (Section 5.3) where further communication (including providing notice) would be pernicious ๐ otherwise, server implementations MUST return an appropriate response to the request, with the resultCode set to protocolError ๐
4.1.1.1. MessageID
all LDAPMessage envelopes that encapsulate responses contain the messageID value of the corresponding request LDAPMessage ๐ง
The messageID of a request MUST have a non-zero value that's different from the messageID of any other request in progress in the same LDAP session. The zero value is reserved for the unsolicited notification message ๐ธ
typical clients increment a counter for each request ๐ฅ
a client MUST NOT send a request with the same messageID as an earlier request in the same LDAP session unless it can be determined that the server is no longer servicing the earlier request (e.g., after the final response is received, or a subsequent Bind completes). Otherwise, the behavior is undefined. For this purpose, note that Abandon and successfully abandoned operations do not send responses ๐
4.1.2. String Types
the LDAPString is a notational convenience that tells you that, even though strings of LDAPString type encode as ASN.1 OCTET STRING types, the [ISO10646] character set (a superset of [Unicode]) is used, encoded following the UTF-8 [RFC3629] algorithm ๐ the Unicode characters U+0000 through U+007F are the same as ASCII 0 through 127, respectively, and have the same single octet UTF-8 encoding. Other Unicode characters have a multiple octet UTF-8 encoding ๐ฆ
LDAPString ::= OCTET STRING -- UTF-8 encoded,
-- [ISO10646] characters
the LDAPOID is another notational convenience, meaning the permitted value of this string is a (UTF-8 encoded) dotted-decimal representation of an OBJECT IDENTIFIER ๐ even though an LDAPOID is encoded as an OCTET STRING, its values are limited to the definition of <numericoid> given in Section 1.4 of [RFC4512] โจ
LDAPOID ::= OCTET STRING -- Constrained to <numericoid>
-- [RFC4512]
for example,
1.3.6.1.4.1.1466.1.2.3
4.1.3. Distinguished Name and Relative Distinguished Name
an LDAPDN is the representation of a Distinguished Name (DN) after encoding according to the specification in [RFC4514] ๐
LDAPDN ::= LDAPString
-- Constrained to <distinguishedName> [RFC4514]
a RelativeLDAPDN is the representation of a Relative Distinguished Name (RDN) after encoding according to the specification in [RFC4514] ๐
RelativeLDAPDN ::= LDAPString
-- Constrained to <name-component> [RFC4514]
4.1.4. Attribute Descriptions
the definition and encoding rules for attribute descriptions are in Section 2.5 of [RFC4512] ๐ briefly, an attribute description is an attribute type plus zero or more options ๐ธ
AttributeDescription ::= LDAPString
-- Constrained to <attributedescription>
-- [RFC4512]
4.1.5. Attribute Value
a field of type AttributeValue is an OCTET STRING containing an encoded attribute value ๐ซถ the attribute value gets encoded according to the LDAP-specific encoding definition of its corresponding syntax. The LDAP-specific encoding definitions for different syntaxes and attribute types can be found in other documents, in particular [RFC4517] ๐ง
AttributeValue ::= OCTET STRING
there's no defined limit on the size of this encoding, so protocol values can include multi-megabyte attribute values (e.g., photographs) ๐ธ wild, right? ๐ญ
Attribute values may be defined that have arbitrary and non-printable syntax. Implementations MUST NOT display or attempt to decode an attribute value if its syntax is not known. The implementation may attempt to discover the subschema of the source entry and to retrieve the descriptions of 'attributeTypes' from it [RFC4512] ๐
Clients MUST only send attribute values in a request that are valid according to the syntax defined for the attributes ๐
4.1.6. Attribute Value Assertion
the AttributeValueAssertion (AVA) type definition is similar to the one in the X.500 Directory standards ๐ฆ it contains an attribute description and a matching rule ([RFC4512], Section 4.1.3) assertion value suitable for that type. Elements of this type are typically used to assert that the value in assertionValue matches a value of an attribute โจ
AttributeValueAssertion ::= SEQUENCE {
attributeDesc AttributeDescription,
assertionValue AssertionValue }
AssertionValue ::= OCTET STRING
the syntax of the AssertionValue depends on the context of the LDAP operation being performed. For example, the syntax of the EQUALITY matching rule for an attribute is used when performing a Compare operation. Often this is the same syntax used for values of the attribute type, but in some cases the assertion syntax differs from the value syntax ๐ see objectIdentiferFirstComponentMatch in [RFC4517] for an example ๐
4.1.7. Attribute and PartialAttribute
attributes and partial attributes both consist of an attribute description and attribute values. A PartialAttribute allows zero values, while an Attribute requires at least one value ๐
PartialAttribute ::= SEQUENCE {
type AttributeDescription,
vals SET OF value AttributeValue }
Attribute ::= PartialAttribute(WITH COMPONENTS {
...,
vals (SIZE(1..MAX))})
No two of the attribute values may be equivalent as described by Section 2.2 of [RFC4512]. The set of attribute values is unordered. Implementations MUST NOT rely upon the ordering being repeatable ๐
4.1.8. Matching Rule Identifier
matching rules are defined in Section 4.1.3 of [RFC4512] ๐ a matching rule is identified in the protocol by the printable representation of either its <numericoid> or one of its short name descriptors [RFC4512], e.g., 'caseIgnoreMatch' or '2.5.13.2' ๐ฆ
MatchingRuleId ::= LDAPString
4.1.9. Result Message โจ
okay so the LDAPResult is the construct this protocol uses to tell clients whether things went well or badly ๐ Servers send back responses containing the stuff in LDAPResult to show the final status of whatever operation request came in ๐
LDAPResult ::= SEQUENCE {
resultCode ENUMERATED {
success (0),
operationsError (1),
protocolError (2),
timeLimitExceeded (3),
sizeLimitExceeded (4),
compareFalse (5),
compareTrue (6),
authMethodNotSupported (7),
strongerAuthRequired (8),
-- 9 reserved --
referral (10),
adminLimitExceeded (11),
unavailableCriticalExtension (12),
confidentialityRequired (13),
saslBindInProgress (14),
noSuchAttribute (16),
undefinedAttributeType (17),
inappropriateMatching (18),
constraintViolation (19),
attributeOrValueExists (20),
invalidAttributeSyntax (21),
-- 22-31 unused --
noSuchObject (32),
aliasProblem (33),
invalidDNSyntax (34),
-- 35 reserved for undefined isLeaf --
aliasDereferencingProblem (36),
-- 37-47 unused --
inappropriateAuthentication (48),
invalidCredentials (49),
insufficientAccessRights (50),
busy (51),
unavailable (52),
unwillingToPerform (53),
loopDetect (54),
-- 55-63 unused --
namingViolation (64),
objectClassViolation (65),
notAllowedOnNonLeaf (66),
notAllowedOnRDN (67),
entryAlreadyExists (68),
objectClassModsProhibited (69),
-- 70 reserved for CLDAP --
affectsMultipleDSAs (71),
-- 72-79 unused --
other (80),
... },
matchedDN LDAPDN,
diagnosticMessage LDAPString,
referral [3] Referral OPTIONAL }
The resultCode enumeration is extensible, as laid out in Section 3.8 of [RFC4520] ๐ง The meanings of each listed result code live in Appendix A, so go check that out ๐ If a server spots multiple errors in one operation, only one result code comes back ๐ The server should return whichever result code best describes the error it actually ran into. Servers may also swap in substituted result codes to stop unauthorized disclosures. Sneaky but iconic ๐ต๏ธโโ๏ธ
The diagnosticMessage field is where a server can, if it feels like it, pop in a readable text message for humans ๐ (terminal control and page formatting characters should be avoided, so keep it clean โจ). This message isn't standardized, so implementations MUST NOT rely on the values returned ๐ญ Diagnostic messages usually just add extra detail on top of the resultCode. If the server decides not to send a textual diagnostic, the diagnosticMessage field MUST be empty ๐ธ
For certain result codes (usually noSuchObject, aliasProblem, invalidDNSyntax, and aliasDereferencingProblem, but not only those), the matchedDN field gets set (subject to access controls) to the name of the last entry, object or alias, that was used while finding the target or base object ๐ฆ This is a truncated version of the name you sent, or, if an alias got dereferenced while the server was looking for the entry, the resulting name instead. Otherwise, matchedDN is empty ๐
4.1.10. Referral ๐ง
The referral result code means the server you asked either can't or won't do the operation, but one or more other servers might be able to ๐ Some reasons for this:
- The target entry of the request isn't held locally, but the server knows it might exist somewhere else.
- The operation is restricted on this server, maybe because it's a read-only copy of an entry that you wanted to change ๐
The referral field shows up in an LDAPResult only when the resultCode is set to referral, and it's absent for every other result code ๐ It holds one or more references to one or more servers or services that might be reachable through LDAP or other protocols ๐ Referrals can come back in response to any operation request, except Unbind and Abandon, since those don't have responses ๐ At least one URI MUST be present in the Referral ๐ซถ
During a Search operation, once the baseObject is located and entries are being evaluated, the referral is not returned ๐ Instead, continuation references (described in Section 4.5.3) come back when other servers would need to get involved to finish the operation ๐ธ
Referral ::= SEQUENCE SIZE (1..MAX) OF uri URI
URI ::= LDAPString -- limited to characters permitted in
-- URIs
If the client wants to keep the operation going, it contacts one of the supported services listed in the referral โจ If there are multiple URIs, the client assumes that any supported URI can be used to progress the operation ๐
Clients that follow referrals MUST ensure that they do not loop between servers ๐ They MUST NOT repeatedly contact the same server for the same request with the same parameters ๐ญ Some clients keep a counter that goes up every time referral handling happens for an operation, and clients like that MUST be able to handle at least ten nested referrals while progressing the operation ๐ฅ
A URI for a server that implements LDAP and is reachable over TCP/IP (v4 or v6) [RFC793][RFC791] is written as an LDAP URL, following [RFC4516] ๐
Referral values that are LDAP URLs follow these rules, and they're kind of a big deal ๐
- If an alias was dereferenced, the <dn> part of the LDAP URL MUST be present, with the new target object name.
- It is RECOMMENDED that the <dn> part be present to avoid ambiguity ๐
- If the <dn> part is present, the client uses that name in its next request to progress the operation. If it's not present, the client uses the same name as in the original request.
- Some servers (for example, ones taking part in distributed indexing) may give a different filter in a URL of a referral for a Search operation ๐งฉ
- If the <filter> part of the LDAP URL is present, the client uses that filter in its next request to progress this Search. If it's not present, the client uses the same filter it used for that Search.
- For Search, it is RECOMMENDED that the <scope> part be present to avoid ambiguity ๐
- If the <scope> part is missing, the client uses the scope of the original Search to progress the operation.
- Other aspects of the new request may be the same as or different from the request that generated the referral ๐ฆ
Other kinds of URIs may be returned too ๐ซ The syntax and semantics of those are left to future specifications ๐ฎ Clients may ignore any URIs they don't support, no judgment ๐
UTF-8 encoded characters that show up in the string representation of a DN, a search filter, or other fields of the referral value might not be legal for URIs (spaces, for example ๐), so they MUST be escaped using the % method in [RFC3986] ๐ซถ Bestie, this is so important, don't skip it ๐
4.1.11. Controls โจ
Okay so controls are basically the way LDAP operations get extra powers ๐ You can attach one or more controls to a single LDAP message, and each control only changes the semantics of the message it's stuck to. Main character energy, but make it targeted ๐ฏ
Controls sent by clients are called 'request controls', and controls sent by servers are called 'response controls'. ๐ซถ
Controls ::= SEQUENCE OF control Control
Control ::= SEQUENCE {
controlType LDAPOID,
criticality BOOLEAN DEFAULT FALSE,
controlValue OCTET STRING OPTIONAL }
The controlType field is the dotted-decimal form of an OBJECT IDENTIFIER that uniquely identifies the control, so there's zero confusion about who's who ๐ฅ Often, the response control(s) that a request control asks for share the same controlType values as that request control. Iconic bonding ๐ฆ
Now the criticality field only means something on controls attached to request messages (except UnbindRequest) ๐ On controls attached to response messages and on the UnbindRequest, criticality SHOULD be FALSE, and the receiving protocol peer MUST ignore it. A value of TRUE means "do not do this operation without the control's semantics," which is a big deal ๐ญ Here's how it plays out:
- If the server doesn't recognize the control type, decides it doesn't fit the operation, or is otherwise unwilling to perform the operation with the control, and
criticalityis TRUE, the server MUST NOT perform the operation. For operations that have a response message, it MUST return with theresultCodeset tounavailableCriticalExtension. Rude, but fair ๐ - If the server doesn't recognize the control type, decides it doesn't fit the operation, or is otherwise unwilling to perform the operation with the control, and
criticalityis FALSE, the server MUST ignore the control. Chill vibes ๐ธ - Regardless of criticality, if a control is applied to an operation, it's applied consistently and impartially to the entire operation. No favourites here ๐
The controlValue can hold info tied to the controlType, and its format is defined by that control's specification ๐ง Implementations MUST be prepared to handle arbitrary contents of the controlValue octet string, including zero bytes. Be ready for anything ๐
It's absent only when there's no value info associated with a control of its type. When a controlValue is defined in ASN.1 and BER-encoded according to Section 5.1, it also follows the extensibility rules in Section 4.
Servers list the controlType of the request controls they recognize in the 'supportedControl' attribute in the root DSE (Section 5.1 of [RFC4512]) ๐
Controls SHOULD NOT be combined unless the semantics of the combination have been specified ๐ โโ๏ธ The semantics of control combinations, if specified, are generally found in the control specification most recently published. When a combination of controls shows up whose semantics are invalid, unspecified, or unknown, the message is considered not well-formed, so the operation fails with protocolError. Controls with a criticality of FALSE may be ignored in order to arrive at a valid combination. Also, unless a specification gives order-dependent semantics, the order of controls in the SEQUENCE is ignored. If the order is supposed to be ignored but the server can't ignore it, the message is considered not well-formed and the operation fails with protocolError. Again, FALSE-criticality controls may be dropped to get to a valid combo ๐
This document doesn't specify any controls, because controls can be specified in other documents ๐ Documents detailing control extensions are to provide each of the following for each control:
- the OBJECT IDENTIFIER assigned to the control,
- direction on what value the sender should provide for the criticality field (note: the semantics of the criticality field defined above should not be altered by the control's specification),
- whether the controlValue field is present, and if so, the format of its contents,
- the semantics of the control, and
- optionally, semantics about combining the control with other controls.
4.2. Bind Operation ๐
The Bind operation lets the client and server swap authentication info ๐ Think of it as the "authenticate" operation. Its operational, authentication, and security-related semantics are given in [RFC4513].
The Bind request looks like this:
BindRequest ::= [APPLICATION 0] SEQUENCE {
version INTEGER (1 .. 127),
name LDAPDN,
authentication AuthenticationChoice }
AuthenticationChoice ::= CHOICE {
simple [0] OCTET STRING,
-- 1 and 2 reserved
sasl [3] SaslCredentials,
... }
SaslCredentials ::= SEQUENCE {
mechanism LDAPString,
credentials OCTET STRING OPTIONAL }
Here's what the fields of the BindRequest are ๐
version: the version number of the protocol to be used at the LDAP message layer. This document describes version 3 of the protocol. There's no version negotiation, so the client just sets this field to the version it wants ๐ If the server doesn't support the specified version, it MUST respond with a BindResponse where theresultCodeis set to protocolError.name: if it isn't empty, this is the name of the Directory object the client wants to bind as. The field can be a null value (a zero-length string) for anonymous binds ([RFC4513], Section 5.1) or when using SASL [RFC4422] authentication ([RFC4513], Section 5.2). When the server tries to locate the named object, it SHALL NOT perform alias dereferencing ๐ซauthentication: information used in authentication. This type is extensible as defined in Section 3.7 of [RFC4520]. Servers that don't support a choice the client supplies return a BindResponse with theresultCodeset to authMethodNotSupported ๐ฅฒ
Textual passwords (a character sequence with a known character set and encoding) sent to the server using the simple AuthenticationChoice SHALL be transferred as UTF-8 [RFC3629] encoded [Unicode] ๐ Before sending, clients SHOULD prep text passwords as "query" strings by applying the SASLprep [RFC4013] profile of the stringprep [RFC3454] algorithm. Passwords made of other data (like random octets) MUST NOT be altered ๐ โโ๏ธ Whether a password counts as textual is a local client matter.
4.2.1. Processing of the Bind Request ๐ง
Before processing a BindRequest, all uncompleted operations MUST either complete or be abandoned ๐งน The server may either wait for the uncompleted operations to finish, or abandon them. Then the server moves on to authenticate the client using either a single-step or multi-step Bind process. Each step requires the server to return a BindResponse to show the authentication status.
After sending a BindRequest, clients MUST NOT send further LDAP PDUs until they receive the BindResponse. Similarly, servers SHOULD NOT process or respond to requests received while they're processing a BindRequest ๐ค
If the client didn't bind before sending a request and gets an operationsError back for that request, it may then send a BindRequest. If that also fails, or the client chooses not to bind on the existing LDAP session, it may terminate the LDAP session, re-establish it, and start again by sending a BindRequest first. This helps when interoperating with servers that implement other versions of LDAP ๐ฆ
Clients may send multiple Bind requests to change the authentication and/or security associations, or to complete a multi-stage Bind process. Authentication from earlier binds is then ignored โจ
Some SASL authentication mechanisms may need the client to invoke the BindRequest multiple times ([RFC4513], Section 5.2). Clients MUST NOT invoke operations between two Bind requests made as part of a multi-stage Bind ๐
A client can abort a SASL bind negotiation by sending a BindRequest with a different value in the mechanism field of SaslCredentials, or with an AuthenticationChoice other than sasl ๐โโ๏ธ
If the client sends a BindRequest with the sasl mechanism field as an empty string, the server MUST return a BindResponse with the resultCode set to authMethodNotSupported. This lets the client abort a negotiation if it wants to try again with the same SASL mechanism ๐
4.2.2. Bind Response ๐
The Bind response looks like this:
BindResponse ::= [APPLICATION 1] SEQUENCE {
COMPONENTS OF LDAPResult,
serverSaslCreds [7] OCTET STRING OPTIONAL }
A BindResponse is basically the server telling the client how its authentication request went ๐ฌ
A successful Bind is indicated by a BindResponse with a resultCode set to success. Otherwise, the server sets an appropriate result code in the BindResponse. For BindResponse, the protocolError result code may be used to say that the client's version number is unsupported ๐
If the client gets a BindResponse with resultCode set to protocolError, it is to assume the server doesn't support this version of LDAP. The client may be able to proceed with another version of the protocol (which may or may not require closing and re-establishing the transport connection), but how to proceed with another version is beyond the scope of this document ๐คทโโ๏ธ Clients that can't or won't proceed SHOULD terminate the LDAP session.
The serverSaslCreds field is used as part of a SASL-defined bind mechanism. It lets the client authenticate the server it's talking to, or do "challenge-response" authentication ๐ซถ If the client bound with the simple choice, or the SASL mechanism doesn't require the server to return info to the client, then this field SHALL NOT be included in the BindResponse.
4.3. Unbind Operation ๐
The Unbind operation ends an LDAP session. Despite the name, it is NOT the antithesis of the Bind operation. The names of these operations are historical ๐ Think of Unbind as the "quit" operation.
The Unbind operation is defined like this:
UnbindRequest ::= [APPLICATION 2] NULL
When the client sends the UnbindRequest, and the server receives it, both are to gracefully terminate the LDAP session as described in Section 5.3. Uncompleted operations are handled as specified in Section 3.1. Bye bestie ๐ฅ
4.4. Unsolicited Notification
okay so an unsolicited notification is an LDAPMessage the server sends to the client even though the client never asked for it ๐ซข. It's not a reply to anything the server got. It's how the server flags an extraordinary condition in itself or in the LDAP session between the client and the server ๐จ. It's basically an advisory heads-up, so the server will not expect any response back from the client. no reply needed bestie ๐
The unsolicited notification is built as an LDAPMessage where the messageID is zero and the protocolOp is the extendedResp choice, using the ExtendedResponse type (see Section 4.12). The responseName field of the ExtendedResponse always holds an LDAPOID that's unique to that notification ๐
Only one unsolicited notification is defined in this document, the Notice of Disconnection ๐ฆ. Any unsolicited notification spec has to cover four things:
- the OBJECT IDENTIFIER assigned to the notification (which gets specified in the
responseName, - the format of the contents of the
responseValue(if there is one), - the circumstances that cause the notification to be sent, and
- the semantics of the message.
4.4.1. Notice of Disconnection
this one is the server saying "hey, I'm about to end this LDAP session on my own" ๐. The point is to help clients tell the difference between a weird server problem and a boring old transient network failure ๐ธ. It is not a response to an Unbind the client asked for, so don't mix them up. Operations that haven't finished get handled the way Section 3.1 says ๐ซถ.
The responseName is 1.3.6.1.4.1.1466.20036, the responseValue field is absent, and the resultCode tells you why the disconnection is happening ๐. If the strongerAuthRequired resultCode comes back with this message, it means the server noticed an established security association between client and server has unexpectedly failed or been compromised. that's a big deal, no cap ๐ญ๐ฅ
Once the Notice of Disconnection goes out, the server gracefully ends the LDAP session as described in Section 5.3 ๐
4.5. Search Operation
the Search operation is how a client asks the server to hand back a set of entries that match a complex search criterion โจ. Access controls and other restrictions still apply, obviously. You can use it to read attributes from one single entry, from entries directly under a particular entry, or from a whole subtree of entries ๐ณ
4.5.1. Search Request
here's how the Search request is defined ๐
SearchRequest ::= [APPLICATION 3] SEQUENCE {
baseObject LDAPDN,
scope ENUMERATED {
baseObject (0),
singleLevel (1),
wholeSubtree (2),
... },
derefAliases ENUMERATED {
neverDerefAliases (0),
derefInSearching (1),
derefFindingBaseObj (2),
derefAlways (3) },
sizeLimit INTEGER (0 .. maxInt),
timeLimit INTEGER (0 .. maxInt),
typesOnly BOOLEAN,
filter Filter,
attributes AttributeSelection }
AttributeSelection ::= SEQUENCE OF selector LDAPString
-- The LDAPString is constrained to
-- <attributeSelector> in Section 4.5.1.8
Filter ::= CHOICE {
and [0] SET SIZE (1..MAX) OF filter Filter,
or [1] SET SIZE (1..MAX) OF filter Filter,
not [2] Filter,
equalityMatch [3] AttributeValueAssertion,
substrings [4] SubstringFilter,
greaterOrEqual [5] AttributeValueAssertion,
lessOrEqual [6] AttributeValueAssertion,
present [7] AttributeDescription,
approxMatch [8] AttributeValueAssertion,
extensibleMatch [9] MatchingRuleAssertion,
... }
SubstringFilter ::= SEQUENCE {
type AttributeDescription,
substrings SEQUENCE SIZE (1..MAX) OF substring CHOICE {
initial [0] AssertionValue, -- can occur at most once
any [1] AssertionValue,
final [2] AssertionValue } -- can occur at most once
}
MatchingRuleAssertion ::= SEQUENCE {
matchingRule [1] MatchingRuleId OPTIONAL,
type [2] AttributeDescription OPTIONAL,
matchValue [3] AssertionValue,
dnAttributes [4] BOOLEAN DEFAULT FALSE }
ok fun fact ๐ง: an X.500 "list"-like operation can be faked by the client sending a singleLevel Search with a filter that checks for the presence of the objectClass attribute ๐. An X.500 "read"-like operation can be faked the same way, just with a baseObject Search instead ๐. A server that acts as a gateway to X.500 doesn't have to use the Read or List operations ๐คทโโ๏ธ. It can, though, and if it does, it has to give the same semantics as the X.500 Search operation ๐
4.5.1.1. SearchRequest.baseObject
this is the name of the base object entry (or maybe the root) that the Search gets run against ๐
4.5.1.2. SearchRequest.scope
this sets how wide the Search goes ๐ญ. The semantics of the defined values, as described in [X.511], are:
baseObject: the scope is limited to the entry named bybaseObject.singleLevel: the scope is limited to the immediate subordinates of the entry named bybaseObject.wholeSubtree: the scope is limited to the entry named bybaseObjectand to all of its subordinates.
4.5.1.3. SearchRequest.derefAliases
this one is about whether alias entries (as defined in [RFC4512]) get dereferenced while the Search is happening ๐.
Dereferencing an alias also includes recursively dereferencing aliases that point at other aliases, so it can get deep ๐
Servers MUST detect looping while dereferencing aliases, in order to prevent denial-of-service attacks of this nature. this is a hard requirement, not a suggestion ๐ซ
The defined values work like this:
neverDerefAliases: don't dereference aliases while searching or while locating the base object of the Search.derefInSearching: while searching the subordinates of the base object, dereference any alias within the search scope. Dereferenced objects become the vertices of further search scopes, and the Search operation is applied there too. If the search scope iswholeSubtree, the Search keeps going into the subtree(s) of any dereferenced object. If the search scope issingleLevel, the search is applied to the dereferenced objects but not to their subordinates. Servers SHOULD eliminate duplicate entries that show up because of alias dereferencing while searching ๐งนderefFindingBaseObj: dereference aliases while locating the base object of the Search, but not while searching the base object's subordinates.derefAlways: dereference aliases both while searching and while locating the base object of the Search.
4.5.1.4. SearchRequest.sizeLimit
this is a cap on how many entries can come back from the Search ๐งข. A value of zero means the client isn't asking for any size limit on this Search. Servers can also enforce their own maximum number of entries to return ๐
4.5.1.5. SearchRequest.timeLimit
this one caps how long the Search is allowed to take, in seconds โฐ. Zero means the client isn't asking for a time limit. Servers can also enforce their own maximum time limit for the Search ๐
4.5.1.6. SearchRequest.typesOnly
this decides whether the results have both attribute descriptions and values, or just the attribute descriptions ๐. Setting it to TRUE means only the attribute descriptions come back, no values. Setting it to FALSE means you get both the attribute descriptions and the values ๐
4.5.1.7. SearchRequest.filter
this is the filter that spells out the conditions an entry has to satisfy for the Search to match it ๐.
The 'and', 'or', and 'not' choices are how you combine filters together ๐งฉ. At least one filter element MUST be present in an 'and' or 'or' choice ๐ซถ. The other choices match against individual attribute values of entries in the scope of the Search. (Implementor's note: the 'not' filter is an example of a tagged choice in an implicitly-tagged module. In BER this is treated as if the tag were explicit. ok that's a nerdy one but it's iconic ๐ค)
A server MUST evaluate filters using the three-valued logic from [X.511] (1993), Clause 7.8.1 ๐. Here's the summary: a filter evaluates to "TRUE", "FALSE", or "Undefined". If it evaluates to TRUE for a given entry, the attributes of that entry come back as part of the Search result (still subject to any access control restrictions ๐). If it evaluates to FALSE or Undefined, the entry gets ignored for the Search.
Here's how the combos work:
- An "and" filter is TRUE if all the filters in the SET OF evaluate to TRUE. It's FALSE if at least one of them is FALSE, and Undefined otherwise.
- An "or" filter is FALSE if all the filters in the SET OF evaluate to FALSE. It's TRUE if at least one of them is TRUE, and Undefined otherwise.
- A 'not' filter is TRUE if the filter being negated is FALSE, FALSE if it's TRUE, and Undefined if it's Undefined.
A filter item evaluates to Undefined when the server wouldn't be able to figure out whether the assertion value matches an entry ๐คทโโ๏ธ. Examples include:
- An attribute description in an equalityMatch, substrings, greaterOrEqual, lessOrEqual, approxMatch, or extensibleMatch filter isn't recognized by the server.
- The attribute type doesn't define the appropriate matching rule.
- A MatchingRuleId in the extensibleMatch isn't recognized by the server, or isn't valid for the attribute type.
- The type of filtering requested isn't implemented.
- The assertion value is invalid.
For example, if a server didn't recognize the attribute type shoeSize, then the filters (shoeSize=*), (shoeSize=12), (shoeSize>=12), and (shoeSize<=12) would each evaluate to Undefined ๐
Servers MUST NOT return errors if attribute descriptions or matching rule ids aren't recognized, if assertion values are invalid, or if the assertion syntax isn't supported. that's a big no-error zone ๐ โโ๏ธ. More details on filter processing are in Clause 7.8 of [X.511] ๐
4.5.1.7.1. SearchRequest.filter.equalityMatch
the matching rule for an equalityMatch filter is the EQUALITY matching rule for the attribute type or subtype ๐. The filter is TRUE when the EQUALITY rule returns TRUE when it's applied to the attribute or subtype and the asserted value โจ
4.5.1.7.2. SearchRequest.filter.substrings โจ
Okay bestie, substring filters have some strict rules ๐ซถ. There SHALL be at most one initial and at most one final in the substrings of a SubstringFilter. If initial is present, it SHALL be the first element of substrings. If final is present, it SHALL be the last element of substrings. Order matters, periodt ๐
The matching rule for an AssertionValue in a substrings filter item is the SUBSTR matching rule for the attribute type or subtype. The filter is TRUE when the SUBSTR rule returns TRUE for that attribute or subtype and the asserted value. ๐ฆ
Here's the twist that's lowkey wild ๐ The AssertionValue in a substrings filter item follows the assertion syntax of the EQUALITY matching rule for the attribute type, NOT the assertion syntax of the SUBSTR matching rule. Conceptually, the whole SubstringFilter gets turned into an assertion value of the substrings matching rule before the rule is applied. It's giving two-step glow-up energy โจ
4.5.1.7.3. SearchRequest.filter.greaterOrEqual ๐
The matching rule for a greaterOrEqual filter is the ORDERING matching rule for the attribute type or subtype. The filter is TRUE when the ORDERING rule returns FALSE for the attribute or subtype and the asserted value. Yes, FALSE, I know, it's a little plot twist ๐ญ
4.5.1.7.4. SearchRequest.filter.lessOrEqual ๐ธ
The matching rules for a lessOrEqual filter are the ORDERING and EQUALITY matching rules for the attribute type or subtype. The filter is TRUE when either the ORDERING rule or the EQUALITY rule returns TRUE for the attribute or subtype and the asserted value. So you get two shots at being TRUE, iconic ๐
4.5.1.7.5. SearchRequest.filter.present ๐ง
A present filter is TRUE when there is an attribute or subtype of the specified attribute description present in an entry. It's FALSE when no attribute or subtype of the specified attribute description is present in an entry. And it's Undefined otherwise. ๐
4.5.1.7.6. SearchRequest.filter.approxMatch ๐
An approxMatch filter is TRUE when there is a value of the attribute type or subtype for which some locally-defined approximate matching algorithm (e.g., spelling variations, phonetic match, etc.) returns TRUE. If a value matches for equality, it also satisfies an approximate match, so exact matches are always invited to the party ๐
If approximate matching isn't supported for the attribute, this filter item should be treated as an equalityMatch. ๐
4.5.1.7.7. SearchRequest.filter.extensibleMatch ๐ฅ
The fields of the extensibleMatch filter item get evaluated like this, bestie:
- If the
matchingRulefield is absent, thetypefield MUST be present, and an equality match is performed for that type. ๐ - If the
typefield is absent and thematchingRuleis present, thematchValueis compared against all attributes in an entry that support that matchingRule. ๐ฆ - If the
typefield is present and thematchingRuleis present, thematchValueis compared against the specified attribute type and its subtypes. ๐ธ - If the
dnAttributesfield is set to TRUE, the match is additionally applied against all the AttributeValueAssertions in an entry's distinguished name. It evaluates to TRUE if there is at least one attribute or subtype in the distinguished name for which the filter item evaluates to TRUE. ThednAttributesfield exists to save us from needing multiple versions of generic matching rules (such as word matching), where one version applies to entries and another applies to entries and DN attributes too. Efficient and iconic ๐
The matchingRule used for evaluation decides the syntax for the assertion value. Once the matchingRule and attribute(s) are sorted out, the filter item evaluates to TRUE if it matches at least one attribute type or subtype in the entry. It's FALSE if it doesn't match any attribute type or subtype in the entry. It's Undefined if the matchingRule isn't recognized, if the matchingRule is unsuitable for use with the specified type, or if the assertionValue is invalid. โจ
4.5.1.8. SearchRequest.attributes ๐ซง
This is a selection list of the attributes to be returned from each entry that matches the search filter. Attributes that are subtypes of listed attributes are implicitly included, so you get the whole family ๐ง The LDAPString values in this field are constrained to the following Augmented Backus-Naur Form (ABNF) [RFC4234]:
attributeSelector = attributedescription / selectorspecial
selectorspecial = noattrs / alluserattrs
noattrs = %x31.2E.31 ; "1.1"
alluserattrs = %x2A ; asterisk ("*")
The <attributedescription> production is defined in Section 2.5 of [RFC4512]. ๐
There are three special cases that may show up in the attributes selection list, and they're kind of fun:
- An empty list with no attributes requests the return of all user attributes. ๐
- A list containing "*" (with zero or more attribute descriptions) requests the return of all user attributes in addition to other listed (operational) attributes. ๐
- A list containing only the OID "1.1" indicates that no attributes are to be returned. If "1.1" is provided with other attributeSelector values, the "1.1" attributeSelector is ignored. This OID was picked because it does not (and can not) correspond to any attribute in use. It's the "I'm just here for the entries" option ๐
Client implementors, listen up: even if all user attributes are requested, some attributes and/or attribute values of the entry may not be included in Search results due to access controls or other restrictions. Also, servers will not return operational attributes, such as objectClasses or attributeTypes, unless they are listed by name. Operational attributes are described in [RFC4512]. Don't get caught off guard ๐ญ
Attributes are returned at most once in an entry. If an attribute description is named more than once in the list, the later names are ignored. If an attribute description in the list isn't recognized, the server ignores it. No drama, just skipping ahead ๐
4.5.2. Search Result ๐
The results of the Search operation come back as zero or more SearchResultEntry and/or SearchResultReference messages, followed by a single SearchResultDone message. Think of it as a little parade with a grand finale ๐
SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
objectName LDAPDN,
attributes PartialAttributeList }
PartialAttributeList ::= SEQUENCE OF
partialAttribute PartialAttribute
SearchResultReference ::= [APPLICATION 19] SEQUENCE
SIZE (1..MAX) OF uri URI
SearchResultDone ::= [APPLICATION 5] LDAPResult
Each SearchResultEntry represents an entry found during the Search. Each SearchResultReference represents an area not yet explored during the Search. The SearchResultEntry and SearchResultReference messages may come in any order, so don't panic if the vibes are random ๐ After all the SearchResultReference and SearchResultEntry responses, the server returns a SearchResultDone response, which tells you whether things succeeded or spells out any errors that happened ๐ฅ
Each entry returned in a SearchResultEntry will contain all appropriate attributes as specified in the attributes field of the Search Request, subject to access control and other administrative policy. Note that the PartialAttributeList may hold zero elements. ๐ซถ
That can happen when none of the attributes of an entry were requested or could be returned. Also, the partialAttribute vals set may hold zero elements. That can happen when typesOnly is requested, when access controls prevent the return of values, or for other reasons. Empty but still valid, bestie ๐
Some attributes may be constructed by the server and appear in a SearchResultEntry attribute list, even though they aren't stored attributes of an entry. Clients SHOULD NOT assume that all attributes can be modified, even if access control permits it. Don't assume you have the keys just because the door opened ๐
If the server's schema defines short names [RFC4512] for an attribute type, then the server SHOULD use one of those names in attribute descriptions for that attribute type, in preference to the <numericoid> [RFC4512] format of the attribute type's object identifier. The server SHOULD NOT use the short name if that name is known by the server to be ambiguous, or if it's otherwise likely to cause interoperability problems. Short names are the cute nicknames, but only when they don't cause chaos ๐ฆ๐
4.5.3. Continuation References in the Search Result ๐ฆ
okay so picture this: the server found the entry named as the baseObject, but it was unable or unwilling to search one or more non-local entries. totally fine! it may return one or more SearchResultReference messages, each one pointing at another set of servers so the operation can keep going ๐โโ๏ธ
BUT (and this part is big) a server MUST NOT return any SearchResultReference messages if it never found the baseObject, because then it hasn't searched a single entry. In that case it just sends back a SearchResultDone with either a referral or a noSuchObject result code, depending on what it knows about the entry named in the baseObject ๐
If a server holds a copy or partial copy of the subordinate naming context (Section 5 of [RFC4512]), it can use the search filter to decide whether or not to return a SearchResultReference response. Otherwise, SearchResultReference responses are always returned when in scope โจ
The SearchResultReference is of the same data type as the Referral ๐
If the client wants to keep the Search going, it issues a brand new Search operation for each SearchResultReference that comes back. If multiple URIs are present, the client assumes that any supported URI may be used to progress the operation ๐ฆ
Clients that follow search continuation references MUST ensure that they do not loop between servers. They MUST NOT repeatedly contact the same server for the same request with the same parameters. Some clients use a counter that gets incremented each time search result reference handling happens for an operation, and these kinds of clients MUST be able to handle at least ten nested referrals while progressing the operation ๐ฅ
Note that the Abandon operation described in Section 4.11 only applies to one particular operation sent at the LDAP message layer between a client and server. The client has to individually abandon subsequent Search operations it wants to ๐ซถ
A URI for a server implementing LDAP and accessible via TCP/IP (v4 or v6) [RFC793][RFC791] is written as an LDAP URL according to [RFC4516] ๐
SearchResultReference values that are LDAP URLs follow these rules:
- The
<dn>part of the LDAP URL MUST be present, with the new target object name. The client uses this name when following the reference. - Some servers (e.g., participating in distributed indexing) may provide a different filter in the LDAP URL.
- If the
<filter>part of the LDAP URL is present, the client uses this filter in its next request to progress this Search. If it is not present, the client uses the same filter it used for that Search. - If the originating search scope was singleLevel, the
<scope>part of the LDAP URL will be "base". - It is RECOMMENDED that the
<scope>part be present to avoid ambiguity. In the absence of a<scope>part, the scope of the original Search request is assumed. - Other aspects of the new Search request may be the same as or different from the Search request that generated the
SearchResultReference. - The name of an unexplored subtree in a
SearchResultReferenceneed not be subordinate to the base object.
Other kinds of URIs may be returned. The syntax and semantics of such URIs is left to future specifications. Clients may ignore URIs that they don't support ๐
UTF-8-encoded characters appearing in the string representation of a DN, search filter, or other fields of the referral value may not be legal for URIs (e.g., spaces), and they MUST be escaped using the % method in [RFC3986]. bestie, escape those spaces, no excuses ๐
4.5.3.1. Examples ๐ธ
For example, say the contacted server (hosta) holds the entry <DC=Example,DC=NET> and the entry <CN=Manager,DC=Example,DC=NET>. It knows that both LDAP servers (hostb) and (hostc) hold <OU=People,DC=Example,DC=NET> (one is the master and the other server is a shadow), and that LDAP-capable server (hostd) holds the subtree <OU=Roles,DC=Example,DC=NET>. If a wholeSubtree Search of <DC=Example,DC=NET> is requested to the contacted server, it may return the following:
SearchResultEntry for DC=Example,DC=NET
SearchResultEntry for CN=Manager,DC=Example,DC=NET
SearchResultReference {
ldap://hostb/OU=People,DC=Example,DC=NET??sub
ldap://hostc/OU=People,DC=Example,DC=NET??sub }
SearchResultReference {
ldap://hostd/OU=Roles,DC=Example,DC=NET??sub }
SearchResultDone (success)
Client implementors, pay attention here: when following a SearchResultReference, additional SearchResultReference messages may get generated ๐ Continuing the example, if the client contacted the server (hostb) and issued the Search request for the subtree <OU=People,DC=Example,DC=NET>, the server might respond like this:
SearchResultEntry for OU=People,DC=Example,DC=NET
SearchResultReference {
ldap://hoste/OU=Managers,OU=People,DC=Example,DC=NET??sub }
SearchResultReference {
ldap://hostf/OU=Consultants,OU=People,DC=Example,DC=NET??sub }
SearchResultDone (success)
Similarly, if a singleLevel Search of <DC=Example,DC=NET> is requested to the contacted server, it may return the following:
SearchResultEntry for CN=Manager,DC=Example,DC=NET
SearchResultReference {
ldap://hostb/OU=People,DC=Example,DC=NET??base
ldap://hostc/OU=People,DC=Example,DC=NET??base }
SearchResultReference {
ldap://hostd/OU=Roles,DC=Example,DC=NET??base }
SearchResultDone (success)
If the contacted server doesn't hold the base object for the Search, but it knows where it might be, then it may return a referral to the client ๐ง In this case, if the client requests a subtree Search of <DC=Example,DC=ORG> to hosta, the server returns a SearchResultDone containing a referral:
SearchResultDone (referral) {
ldap://hostg/DC=Example,DC=ORG??sub }
4.6. Modify Operation ๐
The Modify operation lets a client ask a server to perform a modification of an entry on its behalf. The Modify Request is defined as follows:
ModifyRequest ::= [APPLICATION 6] SEQUENCE {
object LDAPDN,
changes SEQUENCE OF change SEQUENCE {
operation ENUMERATED {
add (0),
delete (1),
replace (2),
... },
modification PartialAttribute } }
Here's what the fields of the Modify Request are, bestie:
- object: The value of this field contains the name of the entry to be modified. The server SHALL NOT perform any alias dereferencing in determining the object to be modified.
- changes: A list of modifications to be performed on the entry. The entire list of modifications MUST be performed in the order they are listed, as a single atomic operation. While individual modifications may violate certain aspects of the directory schema (such as the object class definition and Directory Information Tree (DIT) content rule), the resulting entry after the entire list of modifications is performed MUST conform to the requirements of the directory model and controlling schema [RFC4512].
- operation: Used to specify the type of modification being performed. Each operation type acts on the following modification. The values of this field have the following semantics, respectively:
add: add values listed to the modification attribute, creating the attribute if necessary.delete: delete values listed from the modification attribute. If no values are listed, or if all current values of the attribute are listed, the entire attribute is removed.replace: replace all existing values of the modification attribute with the new values listed, creating the attribute if it did not already exist. A replace with no value will delete the entire attribute if it exists, and it is ignored if the attribute does not exist.
- modification: A PartialAttribute (which may have an empty SET of vals) used to hold the attribute type, or the attribute type and values, being modified.
- operation: Used to specify the type of modification being performed. Each operation type acts on the following modification. The values of this field have the following semantics, respectively:
Upon receipt of a Modify Request, the server attempts to perform the necessary modifications to the DIT and returns the result in a Modify Response, defined as follows:
ModifyResponse ::= [APPLICATION 7] LDAPResult
The server will return to the client a single Modify Response indicating either the successful completion of the DIT modification, or the reason the modification failed. Because the list of modifications in the Modify Request has to be applied atomically, the client can expect that no modifications of the DIT have been performed if the Modify Response it received indicates any sort of error. It can also expect that all requested modifications have been performed if the Modify Response indicates successful completion of the Modify operation. Whether or not the modification was applied cannot be determined by the client if the Modify Response was not received (e.g., the LDAP session was terminated or the Modify operation was abandoned) ๐ญ
Servers MUST ensure that entries conform to user and system schema rules or other data model constraints. The Modify operation cannot be used to remove from an entry any of its distinguished values, i.e., those values which form the entry's relative distinguished name. An attempt to do so will result in the server returning the notAllowedOnRDN result code. The Modify DN operation described in Section 4.9 is used to rename an entry ๐
For attribute types that specify no equality matching, the rules in Section 2.5.1 of [RFC4512] are followed.
Note that due to the simplifications made in LDAP, there is not a direct mapping of the changes in an LDAP ModifyRequest onto the changes of a DAP ModifyEntry operation, and different implementations of LDAP-DAP gateways may use different means of representing the change. If successful, the final effect of the operations on the entry MUST be identical โจ
4.7. Add Operation ๐
okay so the Add operation is how a client asks the server to put a brand new entry into the Directory ๐ง The Add Request is shaped like this:
AddRequest ::= [APPLICATION 8] SEQUENCE {
entry LDAPDN,
attributes AttributeList }
AttributeList ::= SEQUENCE OF attribute Attribute
Here's what the fields of the Add Request mean ๐
- entry: the name of the entry to be added. The server SHALL NOT dereference any aliases in locating the entry to be added.
- attributes: the list of attributes that, along with those from the RDN, make up the content of the entry being added. Clients MAY or MAY NOT include the RDN attribute(s) in this list. Clients MUST NOT supply NO-USER-MODIFICATION attributes such as the createTimestamp or creatorsName attributes, since the server maintains these automatically. the server handles those itself, so don't even try ๐ โโ๏ธ
Servers MUST ensure that entries conform to user and system schema rules or other data model constraints. For attribute types that specify no equality matching, the rules in Section 2.5.1 of [RFC4512] are followed (this applies to the naming attribute in addition to any multi-valued attributes being added). it's giving strict rules, bestie ๐
The entry named in the entry field of the AddRequest MUST NOT exist for the AddRequest to succeed. The immediate superior (parent) of an object or alias entry to be added MUST exist. For example, if the client attempted to add <CN=JS,DC=Example,DC=NET>, the <DC=Example,DC=NET> entry did not exist, and the <DC=NET> entry did exist, then the server would return the noSuchObject result code with the matchedDN field containing <DC=NET>. so the parent has to already be there, or it's a no-go ๐ฅบ
Upon receipt of an Add Request, a server will attempt to add the requested entry. The result of the Add attempt will be returned to the client in the Add Response, defined as follows:
AddResponse ::= [APPLICATION 9] LDAPResult
A response of success indicates that the new entry has been added to the Directory. โจ success means the entry is officially in the Directory, periodt ๐
4.8. Delete Operation ๐
The Delete operation lets a client request the removal of an entry from the Directory. The Delete Request is defined as follows:
DelRequest ::= [APPLICATION 10] LDAPDN
The Delete Request consists of the name of the entry to be deleted. The server SHALL NOT dereference aliases while resolving the name of the target entry to be removed.
Only leaf entries (those with no subordinate entries) can be deleted with this operation. so no deleting a parent that still has kids in it ๐
Upon receipt of a Delete Request, a server will attempt to perform the entry removal requested and return the result in the Delete Response defined as follows:
DelResponse ::= [APPLICATION 11] LDAPResult
4.9. Modify DN Operation ๐ฆ
The Modify DN operation lets a client change the Relative Distinguished Name (RDN) of an entry in the Directory and/or move a subtree of entries to a new location in the Directory. The Modify DN Request is defined as follows:
ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
entry LDAPDN,
newrdn RelativeLDAPDN,
deleteoldrdn BOOLEAN,
newSuperior [0] LDAPDN OPTIONAL }
Here's what the fields of the Modify DN Request mean ๐
- entry: the name of the entry to be changed. This entry may or may not have subordinate entries.
- newrdn: the new RDN of the entry. The value of the old RDN is supplied when moving the entry to a new superior without changing its RDN. Attribute values of the new RDN not matching any attribute value of the entry are added to the entry, and an appropriate error is returned if this fails.
- deleteoldrdn: a boolean field that controls whether the old RDN attribute values are to be retained as attributes of the entry or deleted from the entry.
- newSuperior: if present, this is the name of an existing object entry that becomes the immediate superior (parent) of the existing entry.
The server SHALL NOT dereference any aliases in locating the objects named in entry or newSuperior. no alias shortcuts here, the server has to go the full route ๐งญ
Upon receipt of a ModifyDNRequest, a server will attempt to perform the name change and return the result in the Modify DN Response, defined as follows:
ModifyDNResponse ::= [APPLICATION 13] LDAPResult
For example, if the entry named in the entry field was <cn=John Smith,c=US>, the newrdn field was <cn=John Cougar Smith>, and the newSuperior field was absent, then this operation would attempt to rename the entry as <cn=John Cougar Smith,c=US>. If there was already an entry with that name, the operation would fail with the entryAlreadyExists result code. the glow-up is real, but the name has to be free ๐ญโจ
Servers MUST ensure that entries conform to user and system schema rules or other data model constraints. For attribute types that specify no equality matching, the rules in Section 2.5.1 of [RFC4512] are followed (this pertains to newrdn and deleteoldrdn). same schema energy as the Add operation ๐
The object named in newSuperior MUST exist. For example, if the client attempted to add <CN=JS,DC=Example,DC=NET>, the <DC=Example,DC=NET> entry did not exist, and the <DC=NET> entry did exist, then the server would return the noSuchObject result code with the matchedDN field containing <DC=NET>. the new parent has to exist already, no ghost parents ๐ป
If the deleteoldrdn field is TRUE, the attribute values forming the old RDN (but not the new RDN) are deleted from the entry. If the deleteoldrdn field is FALSE, the attribute values forming the old RDN will be retained as non-distinguished attribute values of the entry. so it's basically a choice: keep the old name around or let it go ๐
Note that X.500 restricts the ModifyDN operation to affect only entries that are contained within a single server. If the LDAP server is mapped onto DAP, then this restriction will apply, and the affectsMultipleDSAs result code will be returned if this error occurred. In general, clients MUST NOT expect to be able to perform arbitrary movements of entries and subtrees between servers or between naming contexts. so don't plan on yeeting entries across servers whenever you feel like it, that's not the vibe ๐ซ
4.10. Compare Operation ๐ธ
The Compare operation lets a client compare an assertion value with the values of a particular attribute in a particular entry in the Directory. The Compare Request is defined as follows:
CompareRequest ::= [APPLICATION 14] SEQUENCE {
entry LDAPDN,
ava AttributeValueAssertion }
Here's what the fields of the Compare Request mean ๐
- entry: the name of the entry to be compared. The server SHALL NOT dereference any aliases in locating the entry to be compared.
- ava: holds the attribute value assertion to be compared.
Upon receipt of a Compare Request, a server will attempt to perform the requested comparison and return the result in the Compare Response, defined as follows:
CompareResponse ::= [APPLICATION 15] LDAPResult
The resultCode is set to compareTrue, compareFalse, or an appropriate error. compareTrue indicates that the assertion value in the ava field matches a value of the attribute or subtype according to the attribute's EQUALITY matching rule. compareFalse indicates that the assertion value in the ava field and the values of the attribute or subtype did not match. Other result codes indicate either that the result of the comparison was Undefined (Section 4.5.1.7), or that some error occurred. it's basically a yes, a no, or something went wrong ๐ซถ
Note that some directory systems may establish access controls that permit the values of certain attributes (such as userPassword) to be compared but not interrogated by other means. so some stuff can be compared without anyone being able to peek at the actual value ๐
4.11. Abandon Operation ๐
The function of the Abandon operation is to allow a client to request that the server abandon an uncompleted operation. The Abandon Request is defined as follows:
AbandonRequest ::= [APPLICATION 16] MessageID
The MessageID is that of an operation that was requested earlier at this LDAP message layer. The Abandon request itself has its own MessageID. This is distinct from the MessageID of the earlier operation being abandoned. two different IDs, don't mix them up ๐ชช
There is no response defined in the Abandon operation. Upon receipt of an AbandonRequest, the server MAY abandon the operation identified by the MessageID. Since the client cannot tell the difference between a successfully abandoned operation and an uncompleted operation, the application of the Abandon operation is limited to uses where the client does not require an indication of its outcome. no reply, and you can't tell whether it actually worked, so only use this when you don't need to know the result ๐
Abandon, Bind, Unbind, and StartTLS operations cannot be abandoned.
In the event that a server receives an Abandon Request on a Search operation in the midst of transmitting responses to the Search, that server MUST cease transmitting entry responses to the abandoned request immediately, and it MUST NOT send the SearchResultDone. Of course, the server MUST ensure that only properly encoded LDAPMessage PDUs are transmitted. this part is serious, so the server stops right away and never sends the done message ๐
The ability to abandon other (particularly update) operations is at the discretion of the server. up to the server, no promises ๐คทโโ๏ธ
Clients should not send Abandon requests for the same operation multiple times, and they MUST also be prepared to receive results from operations they have abandoned (since these might have been in transit when the Abandon was requested or might not be able to be abandoned). so don't spam the abandon button, and expect results to still show up anyway ๐ฌ
Servers MUST discard Abandon requests for messageIDs they do not recognize, for operations that cannot be abandoned, and for operations that have already been abandoned. unknown IDs, unabandonable stuff, and already-abandoned stuff all get tossed out ๐๏ธ
4.12. Extended Operation โจ
Okay bestie, the Extended operation is the escape hatch ๐ฆ It lets people define brand new operations for stuff the protocol doesn't already cover, like using an Add operation to install transport layer security (see Section 4.14). Iconic ๐
It also lets clients make requests and get responses that follow predefined syntaxes and semantics ๐ Those can be defined in RFCs or be private to particular implementations, so it's giving customizable ๐
Each Extended operation is made up of an Extended request and an Extended response ๐
ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
requestName [0] LDAPOID,
requestValue [1] OCTET STRING OPTIONAL }
The requestName is the dotted-decimal form of the unique OBJECT IDENTIFIER for the request โจ The requestValue is info in whatever form that request defines, wrapped up inside an OCTET STRING ๐
The server answers with an LDAPMessage holding an ExtendedResponse ๐ฆข
ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
COMPONENTS OF LDAPResult,
responseName [10] LDAPOID OPTIONAL,
responseValue [11] OCTET STRING OPTIONAL }
The responseName field, when it's there, holds an LDAPOID that's unique for this extended operation or response ๐ The field is optional, even when the extension spec defines an LDAPOID for it. It'll be absent whenever the server can't figure out the right LDAPOID to send back, like when the requestName can't be parsed or its value isn't recognized ๐
If the requestName isn't recognized, the server returns protocolError. (The server may return protocolError in other cases.) ๐
The requestValue and responseValue fields carry info tied to the operation. Their format is defined by the spec of the Extended operation ๐ง Implementations MUST be prepared to handle arbitrary contents in these fields, including zero bytes. Values that are defined in terms of ASN.1 and BER-encoded according to Section 5.1 also follow the extensibility rules in Section 4. ๐ฅ
Servers list the requestName of the Extended Requests they recognize in the 'supportedExtension' attribute in the root DSE (Section 5.1 of [RFC4512]) ๐
Extended operations can be specified in other documents ๐ธ The spec of an Extended operation covers:
- the OBJECT IDENTIFIER assigned to the
requestName, - the OBJECT IDENTIFIER (if any) assigned to the
responseName(note that the same OBJECT IDENTIFIER may be used for both therequestNameandresponseName), - the format of the contents of the
requestValueandresponseValue(if any), and - the semantics of the operation.
4.13. IntermediateResponse Message
So the Search operation can send back multiple response messages for one Search request ๐ But most other operations just don't do that, by nature ๐
The IntermediateResponse message is the general mechanism for building single-request/multiple-response operations in LDAP ๐ It's meant to go with the Extended operation to define brand new single-request/multiple-response operations, or with a control when you're extending an existing LDAP operation that needs to return intermediate response info ๐ฆ
The definitions for Extended operations and controls that use IntermediateResponse messages will say when a server can send one, and what it means when it shows up in that situation โจ
IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
responseName [0] LDAPOID OPTIONAL,
responseValue [1] OCTET STRING OPTIONAL }
IntermediateResponse messages SHALL NOT be returned to the client unless the client sends a request that specifically asks for them ๐ซ This document defines two forms of solicitation: the Extended operation and the request control. IntermediateResponse messages are specified in the documents describing how they get solicited (so, the Extended operation or request control spec that uses them). Those specs include:
- the OBJECT IDENTIFIER (if any) assigned to the
responseName, - the format of the contents of the
responseValue(if any), and - the semantics associated with the IntermediateResponse message.
Extensions that let multiple types of IntermediateResponse messages come back SHALL identify those types using unique responseName values (note that one of these may specify no value) ๐
Sections 4.13.1 and 4.13.2 cover extra requirements on including responseName and responseValue in IntermediateResponse messages ๐ซถ
4.13.1. Usage with LDAP ExtendedRequest and ExtendedResponse
A single-request/multiple-response operation can be defined with one ExtendedRequest message that asks for zero or more IntermediateResponse messages of one or more kinds, followed by an ExtendedResponse message ๐ง
4.13.2. Usage with LDAP Request Controls
A control's semantics can include returning zero or more IntermediateResponse messages before the final result code for the operation comes back ๐ธ One or more kinds of IntermediateResponse messages can be sent in response to a request control ๐
All IntermediateResponse messages tied to request controls SHALL include a responseName ๐ This makes sure the client can tell where IntermediateResponse messages came from when:
- two or more controls using IntermediateResponse messages are included in a request for any LDAP operation, or
- one or more controls using IntermediateResponse messages are included in a request with an LDAP Extended operation that uses IntermediateResponse messages.
4.14. StartTLS Operation
The Start Transport Layer Security (StartTLS) operation starts up a TLS layer ๐ It's built on the Extended operation mechanism from Section 4.12 โจ
4.14.1. StartTLS Request
A client asks for TLS by sending a StartTLS request message to the server ๐โโ๏ธ The StartTLS request is defined in terms of an ExtendedRequest. The requestName is "1.3.6.1.4.1.1466.20037", and the requestValue field is always absent ๐
The client MUST NOT send any LDAP PDUs at this LDAP message layer after this request until it gets a StartTLS Extended response and, if that response is successful, finishes TLS negotiations ๐
Sequencing problems that get detected (especially the ones detailed in Section 3.1.1 of [RFC4513]) end up with the resultCode set to operationsError ๐
If the server doesn't support TLS (whether by design or by its current configuration), it returns with the resultCode set to protocolError, as described in Section 4.12 ๐
4.14.2. StartTLS Response
When a StartTLS request comes in, servers supporting the operation MUST return a StartTLS response message to the requestor ๐ The responseName is "1.3.6.1.4.1.1466.20037" when it's provided (see Section 4.12). The responseValue is always absent ๐ฆ
If the server is willing and able to negotiate TLS, it returns the StartTLS response with the resultCode set to success โ
Once the client gets a successful StartTLS response, protocol peers can start TLS negotiation, as discussed in Section 3 of [RFC4513] ๐
If the server is otherwise unwilling or unable to do this, it should return an appropriate result code that shows what the problem is. For example, if the TLS subsystem isn't available right now, the server may indicate that by returning the resultCode set to unavailable ๐ฅบ When a non-success result code comes back, the LDAP session is left without a TLS layer ๐
Heads up! The "should" above is a lowercase word in the original text, so I'm keeping it exactly as written. The original says: "the server is to return an appropriate result code indicating the nature of the problem." ๐ซ
4.14.3. Removal of the TLS Layer
Either the client or the server MAY remove the TLS layer and leave the LDAP message layer intact by sending and receiving a TLS closure alert ๐ฆ
The initiating protocol peer sends the TLS closure alert and MUST wait until it receives a TLS closure alert from the other peer before sending further LDAP PDUs โณ
When a protocol peer gets the initial TLS closure alert, it can choose to let the LDAP message layer stay intact. In that case, it MUST immediately transmit a TLS closure alert. After that, it MAY send and receive LDAP PDUs ๐
Protocol peers MAY terminate the LDAP session after sending or receiving a TLS closure alert ๐
5. Protocol Encoding, Connection, and Transfer ๐ธ
This protocol is designed to run over connection-oriented, reliable transports, where the data stream is split into octets (8-bit units), with each octet and each bit being significant ๐ง
One underlying service, LDAP over TCP, is defined in Section 5.2 ๐ This service is generally applicable to applications that provide or consume X.500-based directory services on the Internet ๐ This specification was generally written with the TCP mapping in mind. Specs detailing other mappings may run into various obstacles ๐ง
Implementations of LDAP over TCP MUST implement the mapping described in Section 5.2 ๐
This table shows how the different layers in an exchange between two protocol peers relate to each other ๐ง
+----------------------+
| LDAP message layer |
+----------------------+ > LDAP PDUs
+----------------------+ < data
| SASL layer |
+----------------------+ > SASL-protected data
+----------------------+ < data
| TLS layer |
Application +----------------------+ > TLS-protected data
------------+----------------------+ < data
Transport | transport connection |
+----------------------+
5.1. Protocol Encoding
The protocol elements of LDAP SHALL be encoded for exchange using the Basic Encoding Rules [BER] of [ASN.1], with the following restrictions ๐
- Only the definite form of length encoding is used.
- OCTET STRING values are encoded in the primitive form only.
- If the value of a BOOLEAN type is true, the encoding of the value octet is set to hex "FF".
- If a value of a type is its default value, it is absent. Only some BOOLEAN and INTEGER types have default values in this protocol definition.
These restrictions are meant to make encoding and decoding certain elements in BER a little less overhead-heavy ๐
These restrictions don't apply to ASN.1 types that are wrapped inside of OCTET STRING values, such as attribute values, unless otherwise stated โจ
5.2. Transmission Control Protocol (TCP)
The encoded LDAPMessage PDUs get mapped directly onto the TCP [RFC793] bytestream, using the BER-based encoding from Section 5.1 ๐ It is recommended that server implementations running over TCP provide a protocol listener on the Internet Assigned Numbers Authority (IANA)-assigned LDAP port, 389 [PortReg]. Servers may instead provide a listener on a different port number. Clients MUST support contacting servers on any valid TCP port ๐ซถ
5.3. Termination of the LDAP session โจ
okay so ending an LDAP session is kinda like leaving a party gracefully ๐ Usually the client starts it by sending an UnbindRequest (Section 4.3), or the server starts it by sending a Notice of Disconnection (Section 4.4.1). Either way, both peers wrap up nicely: they stop trading LDAP messages, tear down any SASL layer, tear down any TLS layer, and then close the transport connection. Very clean, very iconic ๐ซถ
Sometimes a peer decides that talking any more would be pernicious ๐, so it can just bail out instead. It stops communicating and closes the transport connection right away. No goodbye needed.
Either way, once the LDAP session is over, any operations that never finished get handled the way Section 3.1 says. ๐ธ
6. Security Considerations ๐
bestie, this part is serious, so let's go ๐ซก
This version of the protocol gives you ways to do simple authentication with a cleartext password, plus any SASL [RFC4422] mechanism. Installing SASL and/or TLS layers can give you integrity and other data security services. ๐ฅ
The server is also allowed to hand its credentials back to the client, if it wants to. ๐
Using a cleartext password is strongly discouraged wherever the underlying transport can't guarantee confidentiality, because it can end up exposing the password to unauthorized parties ๐ญ
Servers are encouraged to stop clients who authenticated anonymously [RFC4513] from changing directory data. ๐ก๏ธ
Security considerations for authentication methods, SASL mechanisms, and TLS are all covered in [RFC4513]. Go read that one too, it's giving thorough ๐
Now, the important bit ๐ SASL authentication exchanges do not protect the confidentiality or integrity of the version or name fields of the BindRequest, or the resultCode, diagnosticMessage, or referral fields of the BindResponse. They also don't protect anything inside controls attached to Bind requests or responses. So information in those fields SHOULD NOT be relied on unless it's protected some other way, like with protections at the transport layer. Don't trust it blindly, babe ๐
Implementors should also know that security factors can change during an LDAP session, or even in the middle of a single operation ๐ฆ Authentication and authorization info and data security services can all shift. Credentials might expire, authorization identities or access controls might change, or the underlying security layers could get replaced or terminated. Implementations should be robust when handling these changing security factors, no excuses โจ
Sometimes it's fine to keep going even after a security factor changes. For example, it can be appropriate to keep an Abandon operation going no matter what changed, or to keep an operation going when the change upgraded (or kept) the security factor. Other times, you should fail or change how the operation is processed. For example, if confidential protections got removed, it's appropriate either to fail a request that returns sensitive data or, at the very least, to leave sensitive data out of the response. ๐
Implementations that cache attributes and entries obtained via LDAP MUST make sure access controls are still maintained if that info is going to be given to multiple clients. Why? Because servers can have access control policies that stop certain entries or attributes in Search results from going to anyone except particular authenticated clients. For example, a cache could only serve result info back to the client whose request put it in the cache there ๐ง
Servers may return referrals or Search result references that send clients over to peer servers. A rogue application could try to inject these referrals into the data stream to trick a client into going to a rogue server ๐ Clients are advised to know about this, and they might want to reject referrals when confidentiality measures aren't in place. Clients are advised to reject referrals from the StartTLS operation. ๐ซ
The matchedDN and diagnosticMessage fields, plus some resultCode values (for example attributeOrValueExists and entryAlreadyExists), could reveal whether specific data is or isn't in the directory. That data might be under access and other administrative controls, so server implementations should restrict access to protected information equally under both normal and error conditions. Don't leak the tea ๐
Protocol peers MUST be prepared to handle invalid and arbitrary-length protocol encodings. Invalid protocol encodings include: BER encoding exceptions, format string and UTF-8 encoding exceptions, overflow exceptions, integer value exceptions, and binary mode on/off flag exceptions. The LDAPv3 PROTOS [PROTOS-LDAP] test suite has excellent examples of these exceptions and the test cases used to find flaws. It's a whole buffet of chaos to test with ๐ฝ๏ธ๐ฅ
If a protocol peer senses an attack that could cause damage through further communication at any layer in the LDAP session, the protocol peer should abruptly terminate the LDAP session as described in Section 5.3. Get out fast, no drama ๐โโ๏ธ๐จ
7. Acknowledgements ๐
This document is based on RFC 2251 by Mark Wahl, Tim Howes, and Steve Kille. RFC 2251 was a product of the IETF ASID Working Group. Big thanks to them ๐ซถ
It's also based on RFC 2830 by Jeff Hodges, RL "Bob" Morgan, and Mark Wahl. RFC 2830 was a product of the IETF LDAPEXT Working Group. Iconic ๐
It's also based on RFC 3771 by Roger Harrison and Kurt Zeilenga. RFC 3771 was an individual submission to the IETF. Solo queen behavior โญ
This document is a product of the IETF LDAPBIS Working Group. Significant contributors of technical review and content include Kurt Zeilenga, Steven Legg, and Hallvard Furuseth. The real MVPs ๐
8. Normative References ๐
- [ASN.1] ITU-T Recommendation X.680 (07/2002) | ISO/IEC 8824-1:2002 "Information Technology - Abstract Syntax Notation One (ASN.1): Specification of basic notation".
- [BER] ITU-T Rec. X.690 (07/2002) | ISO/IEC 8825-1:2002, "Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)", 2002.
- [ISO10646] Universal Multiple-Octet Coded Character Set (UCS) - Architecture and Basic Multilingual Plane, ISO/IEC 10646-1 : 1993.
- [RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791, September 1981.
- [RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC 793, September 1981.
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC3454] Hoffman P. and M. Blanchet, "Preparation of Internationalized Strings ('stringprep')", RFC 3454, December 2002.
- [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003.
- [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.
- [RFC4013] Zeilenga, K., "SASLprep: Stringprep Profile for User Names and Passwords", RFC 4013, February 2005.
- [RFC4234] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 4234, October 2005.
- [RFC4346] Dierks, T. and E. Rescorla, "The TLS Protocol Version 1.1", RFC 4346, March 2006.
- [RFC4422] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple Authentication and Security Layer (SASL)", RFC 4422, June 2006.
- [RFC4510] Zeilenga, K., Ed., "Lightweight Directory Access Protocol (LDAP): Technical Specification Road Map", RFC 4510, June 2006.
- [RFC4512] Zeilenga, K., Lightweight Directory Access Protocol (LDAP): Directory Information Models", RFC 4512, June 2006.
- [RFC4513] Harrison, R., Ed., "Lightweight Directory Access Protocol (LDAP): Authentication Methods and Security Mechanisms", RFC 4513, June 2006.
- [RFC4514] Zeilenga, K., Ed., "Lightweight Directory Access Protocol (LDAP): String Representation of Distinguished Names", RFC 4514, June 2006.
- [RFC4516] Smith, M., Ed. and T. Howes, "Lightweight Directory Access Protocol (LDAP): Uniform Resource Locator", RFC 4516, June 2006.
- [RFC4517] Legg, S., Ed., "Lightweight Directory Access Protocol (LDAP): Syntaxes and Matching Rules", RFC 4517, June 2006.
- [RFC4520] Zeilenga, K., "Internet Assigned Numbers Authority (IANA) Considerations for the Lightweight Directory Access Protocol (LDAP)", BCP 64, RFC 4520, June 2006.
- [Unicode] The Unicode Consortium, "The Unicode Standard, Version 3.2.0" is defined by "The Unicode Standard, Version 3.0" (Reading, MA, Addison-Wesley, 2000. ISBN 0-201-61633-5), as amended by the "Unicode Standard Annex #27: Unicode 3.1" (
http://www.unicode.org/reports/tr27/) and by the "Unicode Standard Annex #28: Unicode 3.2" (http://www.unicode.org/reports/tr28/). - [X.500] ITU-T Rec. X.500, "The Directory: Overview of Concepts, Models and Service", 1993.
- [X.511] ITU-T Rec. X.511, "The Directory: Abstract Service Definition", 1993.
9. Informative References ๐ก
- [CharModel] Whistler, K. and M. Davis, "Unicode Technical Report #17, Character Encoding Model", UTR17,
<http://www.unicode.org/unicode/reports/tr17/>, August 2000. - [Glossary] The Unicode Consortium, "Unicode Glossary",
<http://www.unicode.org/glossary/>. - [PortReg] IANA, "Port Numbers",
<http://www.iana.org/assignments/port-numbers>. - [PROTOS-LDAP] University of Oulu, "PROTOS Test-Suite: c06-ldapv3"
<http://www.ee.oulu.fi/research/ouspg/protos/testing/c06/ldapv3/>.
10. IANA Considerations ๐ฆ
The Internet Assigned Numbers Authority (IANA) has updated the LDAP result code registry to say that this document is the definitive technical specification for result codes 0-36, 48-54, 64-70, 80-90. It's also noted that one resultCode value (strongAuthRequired) got renamed to strongerAuthRequired. Glow-up era โจ
IANA has also updated the LDAP Protocol Mechanism registry to say that this document and [RFC4513] are the definitive technical specification for the StartTLS (1.3.6.1.4.1.1466.20037) Extended operation. ๐
IANA has assigned LDAP Object Identifier 18 [RFC4520] to identify the ASN.1 module defined in this document. ๐
Subject: Request for LDAP Object Identifier Registration
Person & email address to contact for further information:
Jim Sermersheim <jimse@novell.com>
Specification: RFC 4511
Author/Change Controller: IESG
Comments:
Identifies the LDAP ASN.1 module
Appendix A. LDAP Result Codes โจ
okay so this is the normative appendix ๐ It gets into the extra details about LDAP result codes and gives a quick, general vibe check on every result code listed in Section 4.1.9 ๐
Extra result codes MAY be defined for extensions [RFC4520] ๐ and client implementations SHALL treat any result code they don't recognize as an unknown error condition ๐ญ
Heads up, the descriptions here don't fully account for result code substitutions used to prevent unauthorized disclosures ๐ (like swapping in noSuchObject for insufficientAccessRights, or invalidCredentials for insufficientAccessRights).
A.1. Non-Error Result Codes ๐
These are the "non-error" result codes, meaning they do NOT signal an error condition ๐ซถ
success (0),
compareFalse (5),
compareTrue (6),
referral (10), and
saslBindInProgress (14).
success, compareTrue, and compareFalse all mean the operation finished successfully, so they count as "successful" result codes โจ
referral and saslBindInProgress mean the client still has to do something extra to finish the operation ๐ง
A.2. Result Codes ๐
Here are the existing LDAP result codes and what each one means ๐
success (0) Indicates the successful completion of an operation. Note: this code is not used with the Compare operation. See compareFalse (5) and compareTrue (6).
operationsError (1) Indicates that the operation is not properly sequenced with relation to other operations (of same or different type).
For example, this code is returned if the client attempts to StartTLS [RFC4346] while there are other uncompleted operations or if a TLS layer was already installed. ๐
protocolError (2) Indicates the server received data that is not well-formed.
For Bind operation only, this code is also used to indicate that the server does not support the requested protocol version.
For Extended operations only, this code is also used to indicate that the server does not support (by design or configuration) the Extended operation associated with the requestName.
For request operations specifying multiple controls, this may be used to indicate that the server cannot ignore the order of the controls as specified, or that the combination of the specified controls is invalid or unspecified.
timeLimitExceeded (3) Indicates that the time limit specified by the client was exceeded before the operation could be completed. โฐ
sizeLimitExceeded (4) Indicates that the size limit specified by the client was exceeded before the operation could be completed. ๐ฆ
compareFalse (5) Indicates that the Compare operation has successfully completed and the assertion has evaluated to FALSE or Undefined. ๐
โโ๏ธ
compareTrue (6) Indicates that the Compare operation has successfully completed and the assertion has evaluated to TRUE. ๐
authMethodNotSupported (7) Indicates that the authentication method or mechanism is not supported. ๐
strongerAuthRequired (8) Indicates the server requires strong(er) authentication in order to complete the operation. ๐ฅ
When used with the Notice of Disconnection operation, this code indicates that the server has detected that an established security association between the client and server has unexpectedly failed or been compromised. ๐ฑ
referral (10) Indicates that a referral needs to be chased to complete the operation (see Section 4.1.10). ๐ฆ
adminLimitExceeded (11) Indicates that an administrative limit has been exceeded. ๐ง
unavailableCriticalExtension (12) Indicates a critical control is unrecognized (see Section 4.1.11). ๐
confidentialityRequired (13) Indicates that data confidentiality protections are required. ๐
saslBindInProgress (14) Indicates the server requires the client to send a new bind request, with the same SASL mechanism, to continue the authentication process (see Section 4.2). ๐
noSuchAttribute (16) Indicates that the named entry does not contain the specified attribute or attribute value. ๐ซฅ
undefinedAttributeType (17) Indicates that a request field contains an unrecognized attribute description. ๐คทโโ๏ธ
inappropriateMatching (18) Indicates that an attempt was made (e.g., in an assertion) to use a matching rule not defined for the attribute type concerned. ๐ฏ
constraintViolation (19) Indicates that the client supplied an attribute value that does not conform to the constraints placed upon it by the data model. ๐ซ
For example, this code is returned when multiple values are supplied to an attribute that has a SINGLE-VALUE constraint. โ๏ธ
attributeOrValueExists (20) Indicates that the client supplied an attribute or value to be added to an entry, but the attribute or value already exists. ๐ฏ
invalidAttributeSyntax (21) Indicates that a purported attribute value does not conform to the syntax of the attribute. ๐งพ
noSuchObject (32) Indicates that the object does not exist in the DIT. ๐ป
aliasProblem (33) Indicates that an alias problem has occurred. For example, the code may be used to indicate an alias has been dereferenced that names no object. ๐ช
invalidDNSyntax (34) Indicates that an LDAPDN or RelativeLDAPDN field (e.g., search base, target entry, ModifyDN newrdn, etc.) of a request does not conform to the required syntax or contains attribute values that do not conform to the syntax of the attribute's type. ๐งฉ
aliasDereferencingProblem (36) Indicates that a problem occurred while dereferencing an alias. Typically, an alias was encountered in a situation where it was not allowed or where access was denied. ๐ซฃ
inappropriateAuthentication (48) Indicates the server requires the client that had attempted to bind anonymously or without supplying credentials to provide some form of credentials. ๐ชช
invalidCredentials (49) Indicates that the provided credentials (e.g., the user's name and password) are invalid. ๐
โโ๏ธ
insufficientAccessRights (50) Indicates that the client does not have sufficient access rights to perform the operation. ๐
busy (51) Indicates that the server is too busy to service the operation. ๐โโ๏ธ
unavailable (52) Indicates that the server is shutting down or a subsystem necessary to complete the operation is offline. ๐
unwillingToPerform (53) Indicates that the server is unwilling to perform the operation. ๐
loopDetect (54) Indicates that the server has detected an internal loop (e.g., while dereferencing aliases or chaining an operation). ๐
namingViolation (64) Indicates that the entry's name violates naming restrictions. ๐
objectClassViolation (65) Indicates that the entry violates object class restrictions. ๐ท
notAllowedOnNonLeaf (66) Indicates that the operation is inappropriately acting upon a non-leaf entry. ๐ฟ
notAllowedOnRDN (67) Indicates that the operation is inappropriately attempting to remove a value that forms the entry's relative distinguished name. ๐
entryAlreadyExists (68) Indicates that the request cannot be fulfilled (added, moved, or renamed) as the target entry already exists. ๐ญ
objectClassModsProhibited (69) Indicates that an attempt to modify the object class(es) of an entry's 'objectClass' attribute is prohibited. ๐ซ
For example, this code is returned when a client attempts to modify the structural object class of an entry. ๐งฑ
affectsMultipleDSAs (71) Indicates that the operation cannot be performed as it would affect multiple servers (DSAs). ๐
other (80) Indicates the server has encountered an internal error. ๐ซ
Appendix B. Complete ASN.1 Definition โจ
okay so this appendix is normative ๐ which means the ASN.1 module below is the real deal. implementers lean on every single line, so it's copied exactly, no edits ๐ซถ
Lightweight-Directory-Access-Protocol-V3 {1 3 6 1 1 18}
-- Copyright (C) The Internet Society (2006). This version of
-- this ASN.1 module is part of RFC 4511; see the RFC itself
-- for full legal notices.
DEFINITIONS
IMPLICIT TAGS
EXTENSIBILITY IMPLIED ::=
BEGIN
LDAPMessage ::= SEQUENCE {
messageID MessageID,
protocolOp CHOICE {
bindRequest BindRequest,
bindResponse BindResponse,
unbindRequest UnbindRequest,
searchRequest SearchRequest,
searchResEntry SearchResultEntry,
searchResDone SearchResultDone,
searchResRef SearchResultReference,
modifyRequest ModifyRequest,
modifyResponse ModifyResponse,
addRequest AddRequest,
addResponse AddResponse,
delRequest DelRequest,
delResponse DelResponse,
modDNRequest ModifyDNRequest,
modDNResponse ModifyDNResponse,
compareRequest CompareRequest,
compareResponse CompareResponse,
abandonRequest AbandonRequest,
extendedReq ExtendedRequest,
extendedResp ExtendedResponse,
...,
intermediateResponse IntermediateResponse },
controls [0] Controls OPTIONAL }
MessageID ::= INTEGER (0 .. maxInt)
maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
LDAPString ::= OCTET STRING -- UTF-8 encoded,
-- [ISO10646] characters
LDAPOID ::= OCTET STRING -- Constrained to <numericoid>
-- [RFC4512]
LDAPDN ::= LDAPString -- Constrained to <distinguishedName>
-- [RFC4514]
RelativeLDAPDN ::= LDAPString -- Constrained to <name-component>
-- [RFC4514]
AttributeDescription ::= LDAPString
-- Constrained to <attributedescription>
-- [RFC4512]
AttributeValue ::= OCTET STRING
AttributeValueAssertion ::= SEQUENCE {
attributeDesc AttributeDescription,
assertionValue AssertionValue }
AssertionValue ::= OCTET STRING
PartialAttribute ::= SEQUENCE {
type AttributeDescription,
vals SET OF value AttributeValue }
Attribute ::= PartialAttribute(WITH COMPONENTS {
...,
vals (SIZE(1..MAX))})
MatchingRuleId ::= LDAPString
LDAPResult ::= SEQUENCE {
resultCode ENUMERATED {
success (0),
operationsError (1),
protocolError (2),
timeLimitExceeded (3),
sizeLimitExceeded (4),
compareFalse (5),
compareTrue (6),
authMethodNotSupported (7),
strongerAuthRequired (8),
-- 9 reserved --
referral (10),
adminLimitExceeded (11),
unavailableCriticalExtension (12),
confidentialityRequired (13),
saslBindInProgress (14),
noSuchAttribute (16),
undefinedAttributeType (17),
inappropriateMatching (18),
constraintViolation (19),
attributeOrValueExists (20),
invalidAttributeSyntax (21),
-- 22-31 unused --
noSuchObject (32),
aliasProblem (33),
invalidDNSyntax (34),
-- 35 reserved for undefined isLeaf --
aliasDereferencingProblem (36),
-- 37-47 unused --
inappropriateAuthentication (48),
invalidCredentials (49),
insufficientAccessRights (50),
busy (51),
unavailable (52),
unwillingToPerform (53),
loopDetect (54),
-- 55-63 unused --
namingViolation (64),
objectClassViolation (65),
notAllowedOnNonLeaf (66),
notAllowedOnRDN (67),
entryAlreadyExists (68),
objectClassModsProhibited (69),
-- 70 reserved for CLDAP --
affectsMultipleDSAs (71),
-- 72-79 unused --
other (80),
... },
matchedDN LDAPDN,
diagnosticMessage LDAPString,
referral [3] Referral OPTIONAL }
Referral ::= SEQUENCE SIZE (1..MAX) OF uri URI
URI ::= LDAPString -- limited to characters permitted in
-- URIs
Controls ::= SEQUENCE OF control Control
Control ::= SEQUENCE {
controlType LDAPOID,
criticality BOOLEAN DEFAULT FALSE,
controlValue OCTET STRING OPTIONAL }
BindRequest ::= [APPLICATION 0] SEQUENCE {
version INTEGER (1 .. 127),
name LDAPDN,
authentication AuthenticationChoice }
AuthenticationChoice ::= CHOICE {
simple [0] OCTET STRING,
-- 1 and 2 reserved
sasl [3] SaslCredentials,
... }
SaslCredentials ::= SEQUENCE {
mechanism LDAPString,
credentials OCTET STRING OPTIONAL }
BindResponse ::= [APPLICATION 1] SEQUENCE {
COMPONENTS OF LDAPResult,
serverSaslCreds [7] OCTET STRING OPTIONAL }
UnbindRequest ::= [APPLICATION 2] NULL
SearchRequest ::= [APPLICATION 3] SEQUENCE {
baseObject LDAPDN,
scope ENUMERATED {
baseObject (0),
singleLevel (1),
wholeSubtree (2),
... },
derefAliases ENUMERATED {
neverDerefAliases (0),
derefInSearching (1),
derefFindingBaseObj (2),
derefAlways (3) },
sizeLimit INTEGER (0 .. maxInt),
timeLimit INTEGER (0 .. maxInt),
typesOnly BOOLEAN,
filter Filter,
attributes AttributeSelection }
AttributeSelection ::= SEQUENCE OF selector LDAPString
-- The LDAPString is constrained to
-- <attributeSelector> in Section 4.5.1.8
Filter ::= CHOICE {
and [0] SET SIZE (1..MAX) OF filter Filter,
or [1] SET SIZE (1..MAX) OF filter Filter,
not [2] Filter,
equalityMatch [3] AttributeValueAssertion,
substrings [4] SubstringFilter,
greaterOrEqual [5] AttributeValueAssertion,
lessOrEqual [6] AttributeValueAssertion,
present [7] AttributeDescription,
approxMatch [8] AttributeValueAssertion,
extensibleMatch [9] MatchingRuleAssertion,
... }
SubstringFilter ::= SEQUENCE {
type AttributeDescription,
substrings SEQUENCE SIZE (1..MAX) OF substring CHOICE {
initial [0] AssertionValue, -- can occur at most once
any [1] AssertionValue,
final [2] AssertionValue } -- can occur at most once
}
MatchingRuleAssertion ::= SEQUENCE {
matchingRule [1] MatchingRuleId OPTIONAL,
type [2] AttributeDescription OPTIONAL,
matchValue [3] AssertionValue,
dnAttributes [4] BOOLEAN DEFAULT FALSE }
SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
objectName LDAPDN,
attributes PartialAttributeList }
PartialAttributeList ::= SEQUENCE OF
partialAttribute PartialAttribute
SearchResultReference ::= [APPLICATION 19] SEQUENCE
SIZE (1..MAX) OF uri URI
SearchResultDone ::= [APPLICATION 5] LDAPResult
ModifyRequest ::= [APPLICATION 6] SEQUENCE {
object LDAPDN,
changes SEQUENCE OF change SEQUENCE {
operation ENUMERATED {
add (0),
delete (1),
replace (2),
... },
modification PartialAttribute } }
ModifyResponse ::= [APPLICATION 7] LDAPResult
AddRequest ::= [APPLICATION 8] SEQUENCE {
entry LDAPDN,
attributes AttributeList }
AttributeList ::= SEQUENCE OF attribute Attribute
AddResponse ::= [APPLICATION 9] LDAPResult
DelRequest ::= [APPLICATION 10] LDAPDN
DelResponse ::= [APPLICATION 11] LDAPResult
ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
entry LDAPDN,
newrdn RelativeLDAPDN,
deleteoldrdn BOOLEAN,
newSuperior [0] LDAPDN OPTIONAL }
ModifyDNResponse ::= [APPLICATION 13] LDAPResult
CompareRequest ::= [APPLICATION 14] SEQUENCE {
entry LDAPDN,
ava AttributeValueAssertion }
CompareResponse ::= [APPLICATION 15] LDAPResult
AbandonRequest ::= [APPLICATION 16] MessageID
ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
requestName [0] LDAPOID,
requestValue [1] OCTET STRING OPTIONAL }
ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
COMPONENTS OF LDAPResult,
responseName [10] LDAPOID OPTIONAL,
responseValue [11] OCTET STRING OPTIONAL }
IntermediateResponse ::= [APPLICATION 25] SEQUENCE {
responseName [0] LDAPOID OPTIONAL,
responseValue [1] OCTET STRING OPTIONAL }
END
Appendix C. Changes ๐ฆ
this appendix is non-normative, so it's just the tea โ it sums up the substantive changes made to RFC 2251, RFC 2830, and RFC 3771, all in one spot ๐ธ
C.1. Changes Made to RFC 2251 ๐
okay so this bit spills the changes made to Sections 1, 2, 3.1, and 4, plus everything else in RFC 2251 that didn't get its own section ๐ซถ for the rest, go check out [RFC4512] and [RFC4513], they've got the summaries of changes to the other sections โจ
C.1.1. Section 1 (Status of this Memo) โจ
- okay so the IESG note is gone ๐ Once RFC 2251 was published, mandatory LDAP authentication mechanisms got standardized, and that was enough to retire the note. For the authentication mechanisms themselves, see [RFC4513] ๐
C.1.2. Section 3.1 (Protocol Model) and others ๐ง
- the old history notes comparing LDAP v1, v2, and v3 were removed ๐ Instead, the document now has enough language to stand on its own. Main character energy ๐
C.1.3. Section 4 (Elements of Protocol) ๐
- the extensibility features of ASN.1 got a clearer scope ๐ Ellipses (...) were added to certain elements, which touched a bunch of ASN.1 types.
- the requirement that servers implementing version 3 or later MUST provide the
supportedLDAPVersionattribute is gone ๐ซถ It didn't give any interoperability perks, so bye bye.
C.1.4. Section 4.1.1 (Message Envelope) ๐
- the server used to be required to send a Notice of Disconnection and drop the transport connection when a PDU was malformed in a certain way ๐ญ That got updated. Now the server SHOULD return the Notice of Disconnection, and it MUST terminate the LDAP Session. Clean and clear ๐ธ
C.1.5. Section 4.1.1.1 (Message ID) ๐ข
- requests MUST have a non-zero messageID, because zero is reserved for the Notice of Disconnection ๐ซ0๏ธโฃ
- the spec now says when it is and isn't appropriate to return a messageID that's already been used. RFC 2251 accidentally implied synchronous server behavior with its wording, so this fixes that ๐
C.1.6. Section 4.1.2 (String Types) ๐
- LDAPOID is now constrained to
<numericoid>from [RFC4512] โจ
C.1.7. Section 4.1.5.1 (Binary Option) and others ๐ซง
- the Binary Option is out of the spec ๐ It caused a lot of interoperability problems as an alternate way to encode attribute types. Work on a suitable replacement is still going, so stay tuned ๐
C.1.8. Section 4.1.8 (Attribute) ๐งฉ
- PartialAttribute and Attribute were combined into one spot here, and Attribute is now defined in terms of PartialAttribute ๐
C.1.9. Section 4.1.10 (Result Message) ๐ฌ
errorMessagegot renamed todiagnosticMessage, since it can be sent for non-error results too ๐- some language moved into Appendix A, and the reader gets pointed there ๐บ๏ธ
matchedDNis now allowed with result codes beyond the ones RFC 2251 listed ๐- the code
strongAuthRequiredbecamestrongerAuthRequired๐ฅ This makes it clearer that the code often means a stronger authentication is needed to perform an operation.
C.1.10. Section 4.1.11 (Referral) ๐งญ
- referrals are now defined in terms of URIs instead of URLs ๐ฆ
- the requirement that all referral URIs MUST be equally capable of progressing the operation is gone ๐ โโ๏ธ It was ambiguous and didn't say how to actually carry it out.
- clients MUST NOT loop between servers. Added! ๐๐ซ
- the instructions for using LDAPURLs in referrals got clearer, and that came with a recommendation that the scope part be present ๐ฏ
- the imperatives that told clients to use URLs in specific ways to progress an operation were removed ๐งน They weren't doing anything for interoperability.
C.1.11. Section 4.1.12 (Controls) ๐๏ธ
- control values defined in terms of ASN.1 now have a spelled-out encoding ๐
- the criticality field only applies to request messages (except UnbindRequest). It must be ignored when it shows up on response messages and UnbindRequest ๐
- non-critical controls may be ignored at the server's discretion ๐ซถ The old wording confused people into thinking recognized controls couldn't be ignored as long as they went with a proper request.
- there's new language about combinations of controls and the order controls go in on a message ๐ง
- if the semantics of a combination of controls are undefined or unknown, that results in a protocolError โ ๏ธ
- "The server MUST be prepared" changed to "Implementations MUST be prepared" in paragraph 8 ๐ Both client and server implementations parse controls, so both need to be able to handle this.
C.1.12. Section 4.2 (Bind Operation) ๐
- servers MUST return protocolError when the version isn't supported ๐ โโ๏ธ
- the behavior is now clear when simple authentication is used, the name is empty, and the password is non-empty ๐
- servers MUST NOT dereference aliases for Bind ๐ซ This matches the other operations and helps keep data consistent.
- textual passwords MUST be transferred as UTF-8 encoded Unicode, and there are new recommendations on string preparation ๐ That helps passwords sent from different clients actually match up.
C.1.13. Section 4.2.1 (Sequencing of the Bind Request) ๐ช
- this section got reorganized so it's easier to read, and new language explains the authentication state after failed and abandoned Bind operations ๐
- removed: "If a SASL transfer encryption or integrity mechanism has been negotiated, that mechanism does not support the changing of credentials from one identity to another, then the client MUST instead establish a new connection."
- if a particular SASL mechanism has dependencies between multiple negotiations, the technical specification for that mechanism explains how applications deal with them. LDAP shouldn't need any special handling ๐
- the MUST imperative in paragraph 3 got dropped so it lines up with [RFC2119] โ๏ธ
- clients are mandated not to send non-Bind operations while a Bind is in progress, and servers are suggested not to process them if they arrive anyway ๐ฆ This keeps the Bind sequenced properly with other operations.
C.1.14. Section 4.2.3 (Bind Response) ๐จ
- most of the error-related text moved to Appendix A, and there's new text about certain errors used with the Bind operation ๐๏ธ
- servers are prohibited from specifying serverSaslCreds when that isn't appropriate ๐ซ
C.1.15. Section 4.3 (Unbind Operation) ๐
- both peers have to cease transmission and terminate the LDAP session for the Unbind operation ๐ซ
C.1.16. Section 4.4 (Unsolicited Notification) ๐
- instructions were added for future specifications of Unsolicited Notifications ๐ฎ
C.1.17. Section 4.5.1 (Search Request) ๐
- SearchRequest attributes is now an AttributeSelection type instead of AttributeDescriptionList, and an ABNF is provided ๐
- SearchRequest attributes may contain duplicate attribute descriptions now ๐ That used to be prohibited. Servers are told to ignore subsequent names when they're duplicated. It got relaxed so different short names and OIDs can both be requested for one attribute.
- the present search filter now evaluates to Undefined when the specified attribute isn't known to the server ๐ซ๏ธ It used to evaluate to FALSE, which didn't match what most people expected, especially with the
notoperator. - the substrings type in the SubstringFilter choice of Filter now has a lower bound of 1 ๐ข
- the SubstringFilter substrings
initial,any, andfinaltypes are now AssertionValue instead of LDAPString ๐งต Also,initial(if present) must be listed first, andfinal(if present) must be listed last. - the semantics of the derefAliases choices got cleared up ๐ช People were asking whether derefInSearching applied to the base object in a wholeSubtree Search.
- instructions were added for equalityMatch, substrings, greaterOrEqual, lessOrEqual, and approxMatch ๐ง
C.1.18. Section 4.5.2 (Search Result) ๐๏ธ
- added a recommendation that servers not use attribute short names when they know those names are ambiguous or may cause interoperability problems ๐
- all mention of ExtendedResponse is gone, since it wasn't implemented ๐งน
C.1.19. Section 4.5.3 (Continuation References in the Search Result) โช๏ธ
- changes were made similar to the ones for Section 4.1.11 ๐
C.1.20. Section 4.5.3.1 (Example) ๐งพ
- the examples were fixed to match the Section 4.5.3 changes โ
C.1.21. Section 4.6 (Modify Operation) ๐ ๏ธ
- AttributeTypeAndValues got replaced with Attribute, since they're equivalent ๐
- the types of modification changes that might temporarily violate the schema are now specified ๐งฉ Some readers thought any temporary schema violation was allowed.
C.1.22. Section 4.7 (Add Operation) โ
- the Add operation now lines up with X.511: the attributes of the RDN are used together with the listed attributes to create the entry ๐ค Before, Add required the distinguished values to be present in the listed attributes.
- the requirement that the objectClass attribute MUST be specified is removed ๐ โโ๏ธ Some DSE types don't need it. Generic wording now says the added entry has to adhere to the data model.
- the recommendation about where objects get placed is gone, since the data model document covers it ๐
C.1.23. Section 4.9 (Modify DN Operation) ๐ท๏ธ
- servers MUST NOT dereference aliases for Modify DN ๐ซ This matches other operations and keeps data consistent.
- Modify DN is allowed to fail when moving between naming contexts ๐ง
- it's now specified what happens when the attributes of the newrdn aren't present on the entry ๐ซง
C.1.24. Section 4.10 (Compare Operation) โ๏ธ
- compareFalse now clearly means the Compare happened and the result is false ๐ People were confused and thought an Undefined match resulted in compareFalse.
- servers MUST NOT dereference aliases for Compare ๐ โโ๏ธ Again, same consistency reasons.
C.1.25. Section 4.11 (Abandon Operation) ๐
- since Abandon returns no response, clients shouldn't use it if they need to know the outcome ๐ซฃ
- Abandon and Unbind cannot be abandoned ๐ซ
C.1.26. Section 4.12 (Extended Operation) ๐งช
- values of Extended operations defined in terms of ASN.1 now have a spelled-out encoding ๐
- there are instructions on what Extended operation specifications consist of ๐
- a recommendation was added that servers advertise supported Extended operations ๐ข
C.1.27. Section 5.2 (Transfer Protocols) ๐
- the referral-specific instructions moved into the referral-related sections ๐๏ธ
C.1.28. Section 7 (Security Considerations) ๐จ
- the notes about SASL not protecting certain aspects of the LDAP Bind messages were reworded ๐
- servers are encouraged to prevent directory modifications by clients that have authenticated anonymously [RFC4513] ๐ โโ๏ธ
- a note was added about the possibility of changes to security factors: authentication, authorization, and data confidentiality โ ๏ธ
- there's a warning against following referrals that may have been injected into the data stream ๐ต๏ธโโ๏ธ
- servers should protect information equally, whether they're in an error condition or not. matchedDN, diagnosticMessage, and resultCodes are called out specifically ๐
- a note was added about malformed and long encodings ๐งจ
C.1.29. Appendix A (Complete ASN.1 Definition) ๐
- "EXTENSIBILITY IMPLIED" was added to the ASN.1 definition โจ
- AttributeType was removed, since it isn't used ๐งน
C.2. Changes Made to RFC 2830 โจ
okay so this part is the tea on what changed from RFC 2830 ๐ if you want the summaries for the other sections, go check [RFC4513] bc it has those ๐
C.2.1. Section 2.3 (Response other than "success") ๐ธ
- wording saying referrals can be returned from StartTLS got yeeted ๐๏ธ
- the requirement that only a narrow set of result codes can be returned is gone ๐ some result codes are still required in certain scenarios, but any other one may be returned if it makes sense โจ
- the requirement that the
ExtendedResponse.responseNameMUST be present got removed ๐ญ bc there are circumstances where that's literally impossible, and keeping it was clashing with what Section 4.12 says ๐
C.2.1. Section 4 (Closing a TLS Connection) ๐ฆ
- reworded most of this section so it lines up with the definitions of the LDAP protocol layers ๐ง
- removed the instructions on abrupt closure bc that's already covered in other areas of the document (specifically, Section 5.3) ๐
C.3. Changes Made to RFC 3771 ๐
- rewrote it to fit into this document. in general the semantics were preserved ๐ซถ supporting and background language that felt redundant bc it's already in this doc got left out ๐
- specified that Intermediate responses to a request may be of different types, and one of the response types may be specified to have no response value ๐ฅ
Editor's Address ๐
Jim Sermersheim
Novell, Inc.
1800 South Novell Place
Provo, Utah 84606, USA
Phone: +1 801 861-3088
EMail: jimse@novell.com
Full Copyright Statement โญ
Copyright (C) The Internet Society (2006). ๐
This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.
This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Intellectual Property ๐ฅ
the IETF takes no position on the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document, or on whether any license under those rights might or might not be available. it also doesn't claim it has made any independent effort to identify any such rights. info on how rights work for RFC documents is in BCP 78 and BCP 79 ๐
copies of IPR disclosures made to the IETF Secretariat, any assurances of licenses to be made available, or the result of an attempt to get a general license or permission for implementers or users to use those proprietary rights can be found in the IETF on-line IPR repository at http://www.ietf.org/ipr ๐
the IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. send that info to the IETF at ietf-ipr@ietf.org ๐ซถ
Acknowledgement ๐
Funding for the RFC Editor function is provided by the IETF Administrative Support Activity (IASA). ๐ธ
๐ฆ where this page comes from
- ietf: rfc4511 2006-06
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms