tech-invite   World Map     

3GPP     Specs     Glossaries     Architecture     IMS     UICC       IETF     RFCs     Groups     SIP     ABNFs       Search

RFC 4511

 
 
 

Lightweight Directory Access Protocol (LDAP): The Protocol

Part 2 of 3, p. 16 to 42
Prev RFC Part       Next RFC Part

 


prevText      Top      Up      ToC       Page 16 
4.2.  Bind Operation

   The function of the Bind operation is to allow authentication
   information to be exchanged between the client and server.  The Bind
   operation should be thought of as the "authenticate" operation.
   Operational, authentication, and security-related semantics of this
   operation are given in [RFC4513].

   The Bind request is defined as follows:

        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 }

   Fields of the BindRequest are:

   - version: A version number indicating the version of the protocol to
     be used at the LDAP message layer.  This document describes version
     3 of the protocol.  There is no version negotiation.  The client
     sets this field to the version it desires.  If the server does not
     support the specified version, it MUST respond with a BindResponse
     where the resultCode is set to protocolError.

   - name: If not empty, the name of the Directory object that the
     client wishes to bind as.  This field may take on a null value (a
     zero-length string) for the purposes of anonymous binds ([RFC4513],
     Section 5.1) or when using SASL [RFC4422] authentication
     ([RFC4513], Section 5.2).  Where the server attempts 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 do
     not support a choice supplied by a client return a BindResponse
     with the resultCode set to authMethodNotSupported.

Top      Up      ToC       Page 17 
     Textual passwords (consisting of a character sequence with a known
     character set and encoding) transferred to the server using the
     simple AuthenticationChoice SHALL be transferred as UTF-8 [RFC3629]
     encoded [Unicode].  Prior to transfer, clients SHOULD prepare text
     passwords as "query" strings by applying the SASLprep [RFC4013]
     profile of the stringprep [RFC3454] algorithm.  Passwords
     consisting of other data (such as random octets) MUST NOT be
     altered.  The determination of whether a password is 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 complete, or abandon them.  The server then
   proceeds to authenticate the client in either a single-step or
   multi-step Bind process.  Each step requires the server to return a
   BindResponse to indicate the status of authentication.

   After sending a BindRequest, clients MUST NOT send further LDAP PDUs
   until receiving the BindResponse.  Similarly, servers SHOULD NOT
   process or respond to requests received while processing a
   BindRequest.

   If the client did not bind before sending a request and receives an
   operationsError to that request, it may then send a BindRequest.  If
   this also fails or the client chooses not to bind on the existing
   LDAP session, it may terminate the LDAP session, re-establish it, and
   begin again by first sending a BindRequest.  This will aid in
   interoperating with servers implementing 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 subsequently ignored.

   For some SASL authentication mechanisms, it may be necessary for 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 may abort a SASL bind negotiation by sending a BindRequest
   with a different value in the mechanism field of SaslCredentials, or
   an AuthenticationChoice other than sasl.

Top      Up      ToC       Page 18 
   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 will allow the client
   to abort a negotiation if it wishes to try again with the same SASL
   mechanism.

4.2.2.  Bind Response

   The Bind response is defined as follows.

        BindResponse ::= [APPLICATION 1] SEQUENCE {
             COMPONENTS OF LDAPResult,
             serverSaslCreds    [7] OCTET STRING OPTIONAL }

   BindResponse consists simply of an indication from the server of the
   status of the client's request for authentication.

   A successful Bind operation is indicated by a BindResponse with a
   resultCode set to success.  Otherwise, an appropriate result code is
   set in the BindResponse.  For BindResponse, the protocolError result
   code may be used to indicate that the version number supplied by the
   client is unsupported.

   If the client receives a BindResponse where the resultCode is set to
   protocolError, it is to assume that the server does not support this
   version of LDAP.  While the client may be able proceed with another
   version of this protocol (which may or may not require closing and
   re-establishing the transport connection), how to proceed with
   another version of this protocol is beyond the scope of this
   document.  Clients that are unable or unwilling to proceed SHOULD
   terminate the LDAP session.

   The serverSaslCreds field is used as part of a SASL-defined bind
   mechanism to allow the client to authenticate the server to which it
   is communicating, or to perform "challenge-response" authentication.
   If the client bound with the simple choice, or the SASL mechanism
   does not require the server to return information to the client, then
   this field SHALL NOT be included in the BindResponse.

4.3.  Unbind Operation

   The function of the Unbind operation is to terminate an LDAP session.
   The Unbind operation is not the antithesis of the Bind operation as
   the name implies.  The naming of these operations are historical.
   The Unbind operation should be thought of as the "quit" operation.

Top      Up      ToC       Page 19 
   The Unbind operation is defined as follows:

        UnbindRequest ::= [APPLICATION 2] NULL

   The client, upon transmission of the UnbindRequest, and the server,
   upon receipt of the UnbindRequest, are to gracefully terminate the
   LDAP session as described in Section 5.3.  Uncompleted operations are
   handled as specified in Section 3.1.

4.4.  Unsolicited Notification

   An unsolicited notification is an LDAPMessage sent from the server to
   the client that is not in response to any LDAPMessage received by the
   server.  It is used to signal an extraordinary condition in the
   server or in the LDAP session between the client and the server.  The
   notification is of an advisory nature, and the server will not expect
   any response to be returned from the client.

   The unsolicited notification is structured as an LDAPMessage in which
   the messageID is zero and protocolOp is set to the extendedResp
   choice using the ExtendedResponse type (See Section 4.12).  The
   responseName field of the ExtendedResponse always contains an LDAPOID
   that is unique for this notification.

   One unsolicited notification (Notice of Disconnection) is defined in
   this document.  The specification of an unsolicited notification
   consists of:

   - the OBJECT IDENTIFIER assigned to the notification (to be specified
     in the responseName,

   - the format of the contents of the responseValue (if any),

   - the circumstances which will cause the notification to be sent, and

   - the semantics of the message.

4.4.1.  Notice of Disconnection

   This notification may be used by the server to advise the client that
   the server is about to terminate the LDAP session on its own
   initiative.  This notification is intended to assist clients in
   distinguishing between an exceptional server condition and a
   transient network failure.  Note that this notification is not a
   response to an Unbind requested by the client.  Uncompleted
   operations are handled as specified in Section 3.1.

Top      Up      ToC       Page 20 
   The responseName is 1.3.6.1.4.1.1466.20036, the responseValue field
   is absent, and the resultCode is used to indicate the reason for the
   disconnection.  When the strongerAuthRequired resultCode is returned
   with this message, it indicates that the server has detected that an
   established security association between the client and server has
   unexpectedly failed or been compromised.

   Upon transmission of the Notice of Disconnection, the server
   gracefully terminates the LDAP session as described in Section 5.3.

4.5.  Search Operation

   The Search operation is used to request a server to return, subject
   to access controls and other restrictions, a set of entries matching
   a complex search criterion.  This can be used to read attributes from
   a single entry, from entries immediately subordinate to a particular
   entry, or from a whole subtree of entries.

4.5.1.  Search Request

   The Search request is defined as follows:

        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,

Top      Up      ToC       Page 21 
             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 }

   Note that an X.500 "list"-like operation can be emulated by the
   client requesting a singleLevel Search operation with a filter
   checking for the presence of the 'objectClass' attribute, and that an
   X.500 "read"-like operation can be emulated by a baseObject Search
   operation with the same filter.  A server that provides a gateway to
   X.500 is not required to use the Read or List operations, although it
   may choose to do so, and if it does, it must provide the same
   semantics as the X.500 Search operation.

4.5.1.1.  SearchRequest.baseObject

   The name of the base object entry (or possibly the root) relative to
   which the Search is to be performed.

4.5.1.2.  SearchRequest.scope

   Specifies the scope of the Search to be performed.  The semantics (as
   described in [X.511]) of the defined values of this field are:

      baseObject: The scope is constrained to the entry named by
      baseObject.

      singleLevel: The scope is constrained to the immediate
      subordinates of the entry named by baseObject.

Top      Up      ToC       Page 22 
      wholeSubtree: The scope is constrained to the entry named by
      baseObject and to all its subordinates.

4.5.1.3.  SearchRequest.derefAliases

   An indicator as to whether or not alias entries (as defined in
   [RFC4512]) are to be dereferenced during stages of the Search
   operation.

   The act of dereferencing an alias includes recursively dereferencing
   aliases that refer to aliases.

   Servers MUST detect looping while dereferencing aliases in order to
   prevent denial-of-service attacks of this nature.

   The semantics of the defined values of this field are:

      neverDerefAliases: Do not dereference aliases in searching or in
      locating the base object of the Search.

      derefInSearching: While searching subordinates of the base object,
      dereference any alias within the search scope.  Dereferenced
      objects become the vertices of further search scopes where the
      Search operation is also applied.  If the search scope is
      wholeSubtree, the Search continues in the subtree(s) of any
      dereferenced object.  If the search scope is singleLevel, the
      search is applied to any dereferenced objects and is not applied
      to their subordinates.  Servers SHOULD eliminate duplicate entries
      that arise due to alias dereferencing while searching.

      derefFindingBaseObj: Dereference aliases in locating the base
      object of the Search, but not when searching subordinates of the
      base object.

      derefAlways: Dereference aliases both in searching and in locating
      the base object of the Search.

4.5.1.4.  SearchRequest.sizeLimit

   A size limit that restricts the maximum number of entries to be
   returned as a result of the Search.  A value of zero in this field
   indicates that no client-requested size limit restrictions are in
   effect for the Search.  Servers may also enforce a maximum number of
   entries to return.

Top      Up      ToC       Page 23 
4.5.1.5.  SearchRequest.timeLimit

   A time limit that restricts the maximum time (in seconds) allowed for
   a Search.  A value of zero in this field indicates that no client-
   requested time limit restrictions are in effect for the Search.
   Servers may also enforce a maximum time limit for the Search.

4.5.1.6.  SearchRequest.typesOnly

   An indicator as to whether Search results are to contain both
   attribute descriptions and values, or just attribute descriptions.
   Setting this field to TRUE causes only attribute descriptions (and
   not values) to be returned.  Setting this field to FALSE causes both
   attribute descriptions and values to be returned.

4.5.1.7.  SearchRequest.filter

   A filter that defines the conditions that must be fulfilled in order
   for the Search to match a given entry.

   The 'and', 'or', and 'not' choices can be used to form combinations
   of filters.  At least one filter element MUST be present in an 'and'
   or 'or' choice.  The others 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.)

   A server MUST evaluate filters according to the three-valued logic of
   [X.511] (1993), Clause 7.8.1.  In summary, a filter is evaluated to
   "TRUE", "FALSE", or "Undefined".  If the filter evaluates to TRUE for
   a particular entry, then the attributes of that entry are returned as
   part of the Search result (subject to any applicable access control
   restrictions).  If the filter evaluates to FALSE or Undefined, then
   the entry is ignored for the Search.

   A filter of the "and" choice is TRUE if all the filters in the SET OF
   evaluate to TRUE, FALSE if at least one filter is FALSE, and
   Undefined otherwise.  A filter of the "or" choice is FALSE if all the
   filters in the SET OF evaluate to FALSE, TRUE if at least one filter
   is TRUE, and Undefined otherwise.  A filter of the 'not' choice is
   TRUE if the filter being negated is FALSE, FALSE if it is TRUE, and
   Undefined if it is Undefined.

   A filter item evaluates to Undefined when the server would not be
   able to determine whether the assertion value matches an entry.
   Examples include:

Top      Up      ToC       Page 24 
   - An attribute description in an equalityMatch, substrings,
     greaterOrEqual, lessOrEqual, approxMatch, or extensibleMatch filter
     is not recognized by the server.

   - The attribute type does not define the appropriate matching rule.

   - A MatchingRuleId in the extensibleMatch is not recognized by the
     server or is not valid for the attribute type.

   - The type of filtering requested is not implemented.

   - The assertion value is invalid.

   For example, if a server did not recognize the attribute type
   shoeSize, 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 are not recognized, assertion values are invalid, or the
   assertion syntax is not supported.  More details of filter processing
   are given in Clause 7.8 of [X.511].

4.5.1.7.1.  SearchRequest.filter.equalityMatch

   The matching rule for an equalityMatch filter is defined by the
   EQUALITY matching rule for the attribute type or subtype.  The filter
   is TRUE when the EQUALITY rule returns TRUE as applied to the
   attribute or subtype and the asserted value.

4.5.1.7.2.  SearchRequest.filter.substrings

   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'.

   The matching rule for an AssertionValue in a substrings filter item
   is defined by the SUBSTR matching rule for the attribute type or
   subtype.  The filter is TRUE when the SUBSTR rule returns TRUE as
   applied to the attribute or subtype and the asserted value.

   Note that the AssertionValue in a substrings filter item conforms to
   the assertion syntax of the EQUALITY matching rule for the attribute
   type rather than to the assertion syntax of the SUBSTR matching rule
   for the attribute type.  Conceptually, the entire SubstringFilter is
   converted into an assertion value of the substrings matching rule
   prior to applying the rule.

Top      Up      ToC       Page 25 
4.5.1.7.3.  SearchRequest.filter.greaterOrEqual

   The matching rule for a greaterOrEqual filter is defined by the
   ORDERING matching rule for the attribute type or subtype.  The filter
   is TRUE when the ORDERING rule returns FALSE as applied to the
   attribute or subtype and the asserted value.

4.5.1.7.4.  SearchRequest.filter.lessOrEqual

   The matching rules for a lessOrEqual filter are defined by the
   ORDERING and EQUALITY matching rules for the attribute type or
   subtype.  The filter is TRUE when either the ORDERING or EQUALITY
   rule returns TRUE as applied to the attribute or subtype and the
   asserted value.

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, FALSE when no
   attribute or subtype of the specified attribute description is
   present in an entry, and 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.  If approximate matching is not 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 are evaluated as
   follows:

   - If the matchingRule field is absent, the type field MUST be
     present, and an equality match is performed for that type.

   - If the type field is absent and the matchingRule is present, the
     matchValue is compared against all attributes in an entry that
     support that matchingRule.

   - If the type field is present and the matchingRule is present, the
     matchValue is compared against the specified attribute type and its
     subtypes.

Top      Up      ToC       Page 26 
   - If the dnAttributes field is set to TRUE, the match is additionally
     applied against all the AttributeValueAssertions in an entry's
     distinguished name, and 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.  The dnAttributes field is present
     to alleviate the need for multiple versions of generic matching
     rules (such as word matching), where one applies to entries and
     another applies to entries and DN attributes as well.

   The matchingRule used for evaluation determines the syntax for the
   assertion value.  Once the matchingRule and attribute(s) have been
   determined, the filter item evaluates to TRUE if it matches at least
   one attribute type or subtype in the entry, FALSE if it does not
   match any attribute type or subtype in the entry, and Undefined if
   the matchingRule is not recognized, the matchingRule is unsuitable
   for use with the specified type, or the assertionValue is invalid.

4.5.1.8.  SearchRequest.attributes

   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.  LDAPString values of 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 appear in the attributes
      selection list:

      1. An empty list with no attributes requests the return of all
         user attributes.

      2. A list containing "*" (with zero or more attribute
         descriptions) requests the return of all user attributes in
         addition to other listed (operational) attributes.

Top      Up      ToC       Page 27 
      3. 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 chosen because it does not (and can not)
         correspond to any attribute in use.

   Client implementors should note that 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.  Furthermore, servers will not return operational
   attributes, such as objectClasses or attributeTypes, unless they are
   listed by name.  Operational attributes are described in [RFC4512].

   Attributes are returned at most once in an entry.  If an attribute
   description is named more than once in the list, the subsequent names
   are ignored.  If an attribute description in the list is not
   recognized, it is ignored by the server.

4.5.2.  Search Result

   The results of the Search operation are returned as zero or more
   SearchResultEntry and/or SearchResultReference messages, followed by
   a single SearchResultDone message.

        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.  Following all the SearchResultReference and
   SearchResultEntry responses, the server returns a SearchResultDone
   response, which contains an indication of success or details any
   errors that have occurred.

   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.

Top      Up      ToC       Page 28 
   This may happen when none of the attributes of an entry were
   requested or could be returned.  Note also that the partialAttribute
   vals set may hold zero elements.  This may happen when typesOnly is
   requested, access controls prevent the return of values, or other
   reasons.

   Some attributes may be constructed by the server and appear in a
   SearchResultEntry attribute list, although they are not stored
   attributes of an entry.  Clients SHOULD NOT assume that all
   attributes can be modified, even if this is permitted by access
   control.

   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 using 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 is otherwise likely
   to cause interoperability problems.

4.5.3.  Continuation References in the Search Result

   If the server was able to locate the entry referred to by the
   baseObject but was unable or unwilling to search one or more non-
   local entries, the server may return one or more
   SearchResultReference messages, each containing a reference to
   another set of servers for continuing the operation.  A server MUST
   NOT return any SearchResultReference messages if it has not located
   the baseObject and thus has not searched any entries.  In this case,
   it would return a SearchResultDone containing either a referral or
   noSuchObject result code (depending on the server's knowledge of 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 may use the search filter to
   determine 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 wishes to progress the Search, it issues a new Search
   operation for each SearchResultReference that is returned.  If
   multiple URIs are present, the client assumes that any supported URI
   may be used to progress the operation.

Top      Up      ToC       Page 29 
   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 is incremented each time search result
   reference handling occurs 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 applies
   only to a particular operation sent at the LDAP message layer between
   a client and server.  The client must individually abandon subsequent
   Search operations it wishes 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, and if it
     is not present the client uses the same filter as 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 SearchResultReference need
     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 do not support.

Top      Up      ToC       Page 30 
   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 MUST be escaped using the % method
   in [RFC3986].

4.5.3.1.  Examples

   For example, suppose 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
   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 should note that when following a
   SearchResultReference, additional SearchResultReference may be
   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 as follows:

     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)

Top      Up      ToC       Page 31 
   If the contacted server does not hold the base object for the Search,
   but has knowledge of its possible location, 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 allows a client to request that a modification
   of an entry be performed on its behalf by a server.  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 } }

   Fields of the Modify Request are:

   - 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.

Top      Up      ToC       Page 32 
           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 attribute type and
        values being modified.

   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 that the modification failed.  Due to the requirement
   for atomicity in applying the list of modifications in the Modify
   Request, the client may expect that no modifications of the DIT have
   been performed if the Modify Response received indicates any sort of
   error, and 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

Top      Up      ToC       Page 33 
   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

   The Add operation allows a client to request the addition of an entry
   into the Directory.  The Add Request is defined as follows:

        AddRequest ::= [APPLICATION 8] SEQUENCE {
             entry           LDAPDN,
             attributes      AttributeList }

        AttributeList ::= SEQUENCE OF attribute Attribute

   Fields of the Add Request are:

   - 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.

   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).

   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>.

   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

Top      Up      ToC       Page 34 
   A response of success indicates that the new entry has been added to
   the Directory.

4.8.  Delete Operation

   The Delete operation allows a client to 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.

   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 allows a client to change the Relative
   Distinguished Name (RDN) of an entry in the Directory and/or to 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 }

   Fields of the Modify DN Request are:

   - 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.

Top      Up      ToC       Page 35 
   - 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.

   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.

   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).

   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>.

   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.

   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.

Top      Up      ToC       Page 36 
4.10.  Compare Operation

   The Compare operation allows a client to 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 }

   Fields of the Compare Request are:

   - 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.

   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.

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.

Top      Up      ToC       Page 37 
   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.

   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.

   The ability to abandon other (particularly update) operations is at
   the discretion of the server.

   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).

   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.

4.12.  Extended Operation

   The Extended operation allows additional operations to be defined for
   services not already available in the protocol; for example, to Add
   operations to install transport layer security (see Section 4.14).

   The Extended operation allows clients to make requests and receive
   responses with predefined syntaxes and semantics.  These may be
   defined in RFCs or be private to particular implementations.

   Each Extended operation consists of an Extended request and an
   Extended response.

        ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
             requestName      [0] LDAPOID,
             requestValue     [1] OCTET STRING OPTIONAL }

Top      Up      ToC       Page 38 
   The requestName is a dotted-decimal representation of the unique
   OBJECT IDENTIFIER corresponding to the request.  The requestValue is
   information in a form defined by that request, encapsulated inside an
   OCTET STRING.

   The server will respond to this with an LDAPMessage containing an
   ExtendedResponse.

        ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
             COMPONENTS OF LDAPResult,
             responseName     [10] LDAPOID OPTIONAL,
             responseValue    [11] OCTET STRING OPTIONAL }

   The responseName field, when present, contains an LDAPOID that is
   unique for this extended operation or response.  This field is
   optional (even when the extension specification defines an LDAPOID
   for use in this field).  The field will be absent whenever the server
   is unable or unwilling to determine the appropriate LDAPOID to
   return, for instance, when the requestName cannot be parsed or its
   value is not recognized.

   Where the requestName is not recognized, the server returns
   protocolError.  (The server may return protocolError in other cases.)

   The requestValue and responseValue fields contain information
   associated with the operation.  The format of these fields is defined
   by the specification of the Extended operation.  Implementations MUST
   be prepared to handle arbitrary contents of 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 Extended Requests they recognize in
   the 'supportedExtension' attribute in the root DSE (Section 5.1 of
   [RFC4512]).

   Extended operations may be specified in other documents.  The
   specification of an Extended operation consists of:

   - 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 the
     requestName and responseName),

Top      Up      ToC       Page 39 
   - the format of the contents of the requestValue and responseValue
     (if any), and

   - the semantics of the operation.

4.13.  IntermediateResponse Message

   While the Search operation provides a mechanism to return multiple
   response messages for a single Search request, other operations, by
   nature, do not provide for multiple response messages.

   The IntermediateResponse message provides a general mechanism for
   defining single-request/multiple-response operations in LDAP.  This
   message is intended to be used in conjunction with the Extended
   operation to define new single-request/multiple-response operations
   or in conjunction with a control when extending existing LDAP
   operations in a way that requires them to return Intermediate
   response information.

   It is intended that the definitions and descriptions of Extended
   operations and controls that make use of the IntermediateResponse
   message will define the circumstances when an IntermediateResponse
   message can be sent by a server and the associated meaning of an
   IntermediateResponse message sent in a particular circumstance.

        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 issues a request that specifically solicits their
   return.  This document defines two forms of solicitation: Extended
   operation and request control.  IntermediateResponse messages are
   specified in documents describing the manner in which they are
   solicited (i.e., in the Extended operation or request control
   specification that uses them).  These specifications 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 allow the return of multiple types of
   IntermediateResponse messages SHALL identify those types using unique
   responseName values (note that one of these may specify no value).

Top      Up      ToC       Page 40 
   Sections 4.13.1 and 4.13.2 describe additional requirements on the
   inclusion of responseName and responseValue in IntermediateResponse
   messages.

4.13.1.  Usage with LDAP ExtendedRequest and ExtendedResponse

   A single-request/multiple-response operation may be defined using a
   single ExtendedRequest message to solicit 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 may include the return of zero or more
   IntermediateResponse messages prior to returning the final result
   code for the operation.  One or more kinds of IntermediateResponse
   messages may be sent in response to a request control.

   All IntermediateResponse messages associated with request controls
   SHALL include a responseName.  This requirement ensures that the
   client can correctly identify the source of IntermediateResponse
   messages 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's purpose is
   to initiate installation of a TLS layer.  The StartTLS operation is
   defined using the Extended operation mechanism described in Section
   4.12.

4.14.1.  StartTLS Request

   A client requests TLS establishment by transmitting 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.

Top      Up      ToC       Page 41 
   The client MUST NOT send any LDAP PDUs at this LDAP message layer
   following this request until it receives a StartTLS Extended response
   and, in the case of a successful response, completes TLS
   negotiations.

   Detected sequencing problems (particularly those detailed in Section
   3.1.1 of [RFC4513]) result in the resultCode being set to
   operationsError.

   If the server does not support TLS (whether by design or by 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 is received, 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 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.  Upon client
   receipt of a successful StartTLS response, protocol peers may
   commence with TLS negotiation as discussed in Section 3 of [RFC4513].

   If the server is otherwise unwilling or unable to perform this
   operation, the server is to return an appropriate result code
   indicating the nature of the problem.  For example, if the TLS
   subsystem is not presently available, the server may indicate this by
   returning with the resultCode set to unavailable.  In cases where a
   non-success result code is returned, the LDAP session is left without
   a TLS layer.

4.14.3.  Removal of the TLS Layer

   Either the client or 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 receives the initial TLS closure alert, it may
   choose to allow the LDAP message layer to remain intact.  In this
   case, it MUST immediately transmit a TLS closure alert.  Following
   this, it MAY send and receive LDAP PDUs.

Top      Up      ToC       Page 42 
   Protocol peers MAY terminate the LDAP session after sending or
   receiving a TLS closure alert.



(page 42 continued on part 3)

Next RFC Part