home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / rfc / 3 / rfc2251.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  111.8 KB  |  2,803 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                            M. Wahl
  8. Request for Comments: 2251                           Critical Angle Inc.
  9. Category: Standards Track                                       T. Howes
  10.                                            Netscape Communications Corp.
  11.                                                                 S. Kille
  12.                                                            Isode Limited
  13.                                                            December 1997
  14.  
  15.  
  16.                Lightweight Directory Access Protocol (v3)
  17.  
  18. 1. Status of this Memo
  19.  
  20.    This document specifies an Internet standards track protocol for the
  21.    Internet community, and requests discussion and suggestions for
  22.    improvements.  Please refer to the current edition of the "Internet
  23.    Official Protocol Standards" (STD 1) for the standardization state
  24.    and status of this protocol.  Distribution of this memo is unlimited.
  25.  
  26. Copyright Notice
  27.  
  28.    Copyright (C) The Internet Society (1997).  All Rights Reserved.
  29.  
  30. IESG Note
  31.  
  32.    This document describes a directory access protocol that provides
  33.    both read and update access.  Update access requires secure
  34.    authentication, but this document does not mandate implementation of
  35.    any satisfactory authentication mechanisms.
  36.  
  37.    In accordance with RFC 2026, section 4.4.1, this specification is
  38.    being approved by IESG as a Proposed Standard despite this
  39.    limitation, for the following reasons:
  40.  
  41.    a. to encourage implementation and interoperability testing of
  42.       these protocols (with or without update access) before they
  43.       are deployed, and
  44.  
  45.    b. to encourage deployment and use of these protocols in read-only
  46.       applications.  (e.g. applications where LDAPv3 is used as
  47.       a query language for directories which are updated by some
  48.       secure mechanism other than LDAP), and
  49.  
  50.    c. to avoid delaying the advancement and deployment of other Internet
  51.       standards-track protocols which require the ability to query, but
  52.       not update, LDAPv3 directory servers.
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Wahl, et. al.               Standards Track                     [Page 1]
  59.  
  60. RFC 2251                         LDAPv3                    December 1997
  61.  
  62.  
  63.    Readers are hereby warned that until mandatory authentication
  64.    mechanisms are standardized, clients and servers written according to
  65.    this specification which make use of update functionality are
  66.    UNLIKELY TO INTEROPERATE, or MAY INTEROPERATE ONLY IF AUTHENTICATION
  67.    IS REDUCED TO AN UNACCEPTABLY WEAK LEVEL.
  68.  
  69.    Implementors are hereby discouraged from deploying LDAPv3 clients or
  70.    servers which implement the update functionality, until a Proposed
  71.    Standard for mandatory authentication in LDAPv3 has been approved and
  72.    published as an RFC.
  73.  
  74. Table of Contents
  75.  
  76.    1.  Status of this Memo ....................................  1
  77.        Copyright Notice .......................................  1
  78.        IESG Note ..............................................  1
  79.    2.  Abstract ...............................................  3
  80.    3.  Models .................................................  4
  81.    3.1. Protocol Model ........................................  4
  82.    3.2. Data Model ............................................  5
  83.    3.2.1. Attributes of Entries ...............................  5
  84.    3.2.2. Subschema Entries and Subentries ....................  7
  85.    3.3. Relationship to X.500 .................................  8
  86.    3.4. Server-specific Data Requirements .....................  8
  87.    4.  Elements of Protocol ...................................  9
  88.    4.1. Common Elements .......................................  9
  89.    4.1.1. Message Envelope ....................................  9
  90.    4.1.1.1. Message ID ........................................ 11
  91.    4.1.2. String Types ........................................ 11
  92.    4.1.3. Distinguished Name and Relative Distinguished Name .. 11
  93.    4.1.4. Attribute Type ...................................... 12
  94.    4.1.5. Attribute Description ............................... 13
  95.    4.1.5.1. Binary Option ..................................... 14
  96.    4.1.6. Attribute Value ..................................... 14
  97.    4.1.7. Attribute Value Assertion ........................... 15
  98.    4.1.8. Attribute ........................................... 15
  99.    4.1.9. Matching Rule Identifier ............................ 15
  100.    4.1.10. Result Message ..................................... 16
  101.    4.1.11. Referral ........................................... 18
  102.    4.1.12. Controls ........................................... 19
  103.    4.2. Bind Operation ........................................ 20
  104.    4.2.1. Sequencing of the Bind Request ...................... 21
  105.    4.2.2. Authentication and Other Security Services .......... 22
  106.    4.2.3. Bind Response ....................................... 23
  107.    4.3. Unbind Operation ...................................... 24
  108.    4.4. Unsolicited Notification .............................. 24
  109.    4.4.1. Notice of Disconnection ............................. 24
  110.    4.5. Search Operation ...................................... 25
  111.  
  112.  
  113.  
  114. Wahl, et. al.               Standards Track                     [Page 2]
  115.  
  116. RFC 2251                         LDAPv3                    December 1997
  117.  
  118.  
  119.    4.5.1. Search Request ...................................... 25
  120.    4.5.2. Search Result ....................................... 29
  121.    4.5.3. Continuation References in the Search Result ........ 31
  122.    4.5.3.1. Example ........................................... 31
  123.    4.6. Modify Operation ...................................... 32
  124.    4.7. Add Operation ......................................... 34
  125.    4.8. Delete Operation ...................................... 35
  126.    4.9. Modify DN Operation ................................... 36
  127.    4.10. Compare Operation .................................... 37
  128.    4.11. Abandon Operation .................................... 38
  129.    4.12. Extended Operation ................................... 38
  130.    5.  Protocol Element Encodings and Transfer ................ 39
  131.    5.1. Mapping Onto BER-based Transport Services ............. 39
  132.    5.2. Transfer Protocols .................................... 40
  133.    5.2.1. Transmission Control Protocol (TCP) ................. 40
  134.    6.  Implementation Guidelines .............................. 40
  135.    6.1. Server Implementations ................................ 40
  136.    6.2. Client Implementations ................................ 40
  137.    7.  Security Considerations ................................ 41
  138.    8.  Acknowledgements ....................................... 41
  139.    9.  Bibliography ........................................... 41
  140.    10. Authors' Addresses ..................................... 42
  141.    Appendix A - Complete ASN.1 Definition ..................... 44
  142.    Full Copyright Statement ................................... 50
  143.  
  144. 2.  Abstract
  145.  
  146.    The protocol described in this document is designed to provide access
  147.    to directories supporting the X.500 models, while not incurring the
  148.    resource requirements of the X.500 Directory Access Protocol (DAP).
  149.    This protocol is specifically targeted at management applications and
  150.    browser applications that provide read/write interactive access to
  151.    directories. When used with a directory supporting the X.500
  152.    protocols, it is intended to be a complement to the X.500 DAP.
  153.  
  154.    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  155.    "SHOULD", "SHOULD NOT", "RECOMMENDED",  and "MAY" in this document
  156.    are to be interpreted as described in RFC 2119 [10].
  157.  
  158.    Key aspects of this version of LDAP are:
  159.  
  160.    - All protocol elements of LDAPv2 (RFC 1777) are supported. The
  161.      protocol is carried directly over TCP or other transport, bypassing
  162.      much of the session/presentation overhead of X.500 DAP.
  163.  
  164.    - Most protocol data elements can be encoded as ordinary strings
  165.      (e.g., Distinguished Names).
  166.  
  167.  
  168.  
  169.  
  170. Wahl, et. al.               Standards Track                     [Page 3]
  171.  
  172. RFC 2251                         LDAPv3                    December 1997
  173.  
  174.  
  175.    - Referrals to other servers may be returned.
  176.  
  177.    - SASL mechanisms may be used with LDAP to provide association
  178.      security services.
  179.  
  180.    - Attribute values and Distinguished Names have been
  181.      internationalized through the use of the ISO 10646 character set.
  182.  
  183.    - The protocol can be extended to support new operations, and
  184.      controls may be used to extend existing operations.
  185.  
  186.    - Schema is published in the directory for use by clients.
  187.  
  188. 3.  Models
  189.  
  190.    Interest in X.500 [1] directory technologies in the Internet has led
  191.    to efforts to reduce the high cost of entry associated with use of
  192.    these technologies.  This document continues the efforts to define
  193.    directory protocol alternatives, updating the LDAP [2] protocol
  194.    specification.
  195.  
  196. 3.1. Protocol Model
  197.  
  198.    The general model adopted by this protocol is one of clients
  199.    performing protocol operations against servers. In this model, a
  200.    client transmits a protocol request describing the operation to be
  201.    performed to a server. The server is then responsible for performing
  202.    the necessary operation(s) in the directory. Upon completion of the
  203.    operation(s), the server returns a response containing any results or
  204.    errors to the requesting client.
  205.  
  206.    In keeping with the goal of easing the costs associated with use of
  207.    the directory, it is an objective of this protocol to minimize the
  208.    complexity of clients so as to facilitate widespread deployment of
  209.    applications capable of using the directory.
  210.  
  211.    Note that although servers are required to return responses whenever
  212.    such responses are defined in the protocol, there is no requirement
  213.    for synchronous behavior on the part of either clients or servers.
  214.    Requests and responses for multiple operations may be exchanged
  215.    between a client and server in any order, provided the client
  216.    eventually receives a response for every request that requires one.
  217.  
  218.    In LDAP versions 1 and 2, no provision was made for protocol servers
  219.    returning referrals to clients.  However, for improved performance
  220.    and distribution this version of the protocol permits servers to
  221.    return to clients referrals to other servers.  This allows servers to
  222.    offload the work of contacting other servers to progress operations.
  223.  
  224.  
  225.  
  226. Wahl, et. al.               Standards Track                     [Page 4]
  227.  
  228. RFC 2251                         LDAPv3                    December 1997
  229.  
  230.  
  231.    Note that the core protocol operations defined in this document can
  232.    be mapped to a strict subset of the X.500(1997) directory abstract
  233.    service, so it can be cleanly provided by the DAP.  However there is
  234.    not a one-to-one mapping between LDAP protocol operations and DAP
  235.    operations: server implementations acting as a gateway to X.500
  236.    directories may need to make multiple DAP requests.
  237.  
  238. 3.2. Data Model
  239.  
  240.    This section provides a brief introduction to the X.500 data model,
  241.    as used by LDAP.
  242.  
  243.    The LDAP protocol assumes there are one or more servers which jointly
  244.    provide access to a Directory Information Tree (DIT).  The tree is
  245.    made up of entries.  Entries have names: one or more attribute values
  246.    from the entry form its relative distinguished name (RDN), which MUST
  247.    be unique among all its siblings.  The concatenation of the relative
  248.    distinguished names of the sequence of entries from a particular
  249.    entry to an immediate subordinate of the root of the tree forms that
  250.    entry's Distinguished Name (DN), which is unique in the tree.  An
  251.    example of a Distinguished Name is
  252.  
  253.    CN=Steve Kille, O=Isode Limited, C=GB
  254.  
  255.    Some servers may hold cache or shadow copies of entries, which can be
  256.    used to answer search and comparison queries, but will return
  257.    referrals or contact other servers if modification operations are
  258.    requested.
  259.  
  260.    Servers which perform caching or shadowing MUST ensure that they do
  261.    not violate any access control constraints placed on the data by the
  262.    originating server.
  263.  
  264.    The largest collection of entries, starting at an entry that is
  265.    mastered by a particular server, and including all its subordinates
  266.    and their subordinates, down to the entries which are mastered by
  267.    different servers, is termed a naming context.  The root of the DIT
  268.    is a DSA-specific Entry (DSE) and not part of any naming context:
  269.    each server has different attribute values in the root DSE.  (DSA is
  270.    an X.500 term for the directory server).
  271.  
  272. 3.2.1. Attributes of Entries
  273.  
  274.    Entries consist of a set of attributes.  An attribute is a type with
  275.    one or more associated values.  The attribute type is identified by a
  276.    short descriptive name and an OID (object identifier). The attribute
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Wahl, et. al.               Standards Track                     [Page 5]
  283.  
  284. RFC 2251                         LDAPv3                    December 1997
  285.  
  286.  
  287.    type governs whether there can be more than one value of an attribute
  288.    of that type in an entry, the syntax to which the values must
  289.    conform, the kinds of matching which can be performed on values of
  290.    that attribute, and other functions.
  291.  
  292.    An example of an attribute is "mail". There may be one or more values
  293.    of this attribute, they must be IA5 (ASCII) strings, and they are
  294.    case insensitive (e.g. "foo@bar.com" will match "FOO@BAR.COM").
  295.  
  296.    Schema is the collection of attribute type definitions, object class
  297.    definitions and other information which a server uses to determine
  298.    how to match a filter or attribute value assertion (in a compare
  299.    operation) against the attributes of an entry, and whether to permit
  300.    add and modify operations.  The definition of schema for useancement and  is given in [5] and [6].  Additional schema elements may be
  301.    defined in other documents.
  302.  
  303.    Each entry MUST have an objectClass attribute.  The objectClass
  304.    attribute specifies the object classes of an entry, which along with
  305.    the system and user schema determine the permitted attributes of an
  306.    entry.  Values of this attribute may be modified by clients, but the
  307.    objectClass attribute cannot be removed.  Servers may restrict the
  308.    modifications of this attribute to prevent the basic structural class
  309.    of the entry from being changed (e.g. one cannot change a person into
  310.    a country).  When creating an entry or adding an objectClass value to
  311.    an entry, all superclasses of the named classes are implicitly added
  312.    as well if not already present, and the client must supply values for
  313.    any mandatory attributes of new superclasses.
  314.  
  315.    Some attributes, termed operational attributes, are used by servers
  316.    for administering the directory system itself.  They are not returned
  317.    in search results unless explicitly requested by name.  Attributes
  318.    which are not operational, such as "mail", will have their schema and
  319.    syntax constraints enforced by servers, but servers will generally
  320.    not make use of their values.
  321.  
  322.    Servers MUST NOT permit clients to add attributes to an entry unless
  323.    those attributes are permitted by the object class definitions, the
  324.    schema controlling that entry (specified in the subschema - see
  325.    below), or are operational attributes known to that server and used
  326.    for administrative purposes.  Note that there is a particular
  327.    objectClass 'extensibleObject' defined in [5] which permits all user
  328.    attributes to be present in an entry.
  329.  
  330.    Entries MAY contain, among others, the following operational
  331.    attributes, defined in [5]. These attributes are maintained
  332.    automatically by the server and are not modifiable by clients:
  333.  
  334.  
  335.  
  336.  
  337. Wahl, et. al.               Standards Track                     [Page 6]
  338.  
  339. RFC 2251                         LDAPv3                    December 1997
  340.  
  341.  
  342.    - creatorsName: the Distinguished Name of the user who added this
  343.      entry to the directory.
  344.  
  345.    - createTimestamp: the time this entry was added to the directory.
  346.  
  347.    - modifiersName: the Distinguished Name of the user who last modified
  348.      this entry.
  349.  
  350.    - modifyTimestamp: the time this entry was last modified.
  351.  
  352.    - subschemaSubentry:  the Distinguished Name of the subschema entry
  353.      (or subentry) which controls the schema for this entry.
  354.  
  355. 3.2.2. Subschema Entries and Subentries
  356.  
  357.    Subschema entries are used for administering information about the
  358.    directory schema, in particular the object classes and attribute
  359.    types supported by directory servers.  A single subschema entry
  360.    contains all schema definitions used by entries in a particular part
  361.    of the directory tree.
  362.  
  363.    Servers which follow X.500(93) models SHOULD implement subschema
  364.    using the X.500 subschema mechanisms, and so these subschemas are not
  365.    ordinary entries.  LDAP clients SHOULD NOT assume that servers
  366.    implement any of the other aspects of X.500 subschema.  A server
  367.    which masters entries and permits clients to modify these entries
  368.    MUST implement and provide access to these subschema entries, so that
  369.    its clients may discover the attributes and object classes which are
  370.    permitted to be present. It is strongly recommended that all other
  371.    servers implement this as well.
  372.  
  373.    The following four attributes MUST be present in all subschema
  374.    entries:
  375.  
  376.    - cn: this attribute MUST be used to form the RDN of the subschema
  377.      entry.
  378.  
  379.    - objectClass: the attribute MUST have at least the values "top" and
  380.      "subschema".
  381.  
  382.    - objectClasses: each value of this attribute specifies an object
  383.      class known to the server.
  384.  
  385.    - attributeTypes: each value of this attribute specifies an attribute
  386.      type known to the server.
  387.  
  388.    These are defined in [5]. Other attributes MAY be present in
  389.    subschema entries, to reflect additional supported capabilities.
  390.  
  391.  
  392.  
  393. Wahl, et. al.               Standards Track                     [Page 7]
  394.  
  395. RFC 2251                         LDAPv3                    December 1997
  396.  
  397.  
  398.    These include matchingRules, matchingRuleUse, dITStructureRules,
  399.    dITContentRules, nameForms and ldapSyntaxes.
  400.  
  401.    Servers SHOULD provide the attributes createTimestamp and
  402.    modifyTimestamp in subschema entries, in order to allow clients to
  403.    maintain their caches of schema information.
  404.  
  405.    Clients MUST only retrieve attributes from a subschema entry by
  406.    requesting a base object search of the entry, where the search filter
  407.    is "(objectClass=subschema)". (This will allow LDAPv3 servers which
  408.    gateway to X.500(93) to detect that subentry information is being
  409.    requested.)
  410.  
  411. 3.3. Relationship to X.500
  412.  
  413.    This document defines LDAP in terms of X.500 as an X.500 access
  414.    mechanism.  An LDAP server MUST act in accordance with the
  415.    X.500(1993) series of ITU recommendations when providing the service.
  416.    However, it is not required that an LDAP server make use of any X.500
  417.    protocols in providing this service, e.g. LDAP can be mapped onto any
  418.    other directory system so long as the X.500 data and service model as
  419.    used in LDAP is not violated in the LDAP interface.
  420.  
  421. 3.4. Server-specific Data Requirements
  422.  
  423.    An LDAP server MUST provide information about itself and other
  424.    information that is specific to each server.  This is represented as
  425.    a group of attributes located in the root DSE (DSA-Specific Entry),
  426.    which is named with the zero-length LDAPDN.  These attributes are
  427.    retrievable if a client performs a base object search of the root
  428.    with filter "(objectClass=*)", however they are subject to access
  429.    control restrictions.  The root DSE MUST NOT be included if the
  430.    client performs a subtree search starting from the root.
  431.  
  432.    Servers may allow clients to modify these attributes.
  433.  
  434.    The following attributes of the root DSE are defined in section 5 of
  435.    [5].  Additional attributes may be defined in other documents.
  436.  
  437.    - namingContexts: naming contexts held in the server. Naming contexts
  438.      are defined in section 17 of X.501 [6].
  439.  
  440.    - subschemaSubentry: subschema entries (or subentries) known by this
  441.      server.
  442.  
  443.    - altServer: alternative servers in case this one is later
  444.      unavailable.
  445.  
  446.  
  447.  
  448.  
  449. Wahl, et. al.               Standards Track                     [Page 8]
  450.  
  451. RFC 2251                         LDAPv3                    December 1997
  452.  
  453.  
  454.    - supportedExtension: list of supported extended operations.
  455.  
  456.    - supportedControl: list of supported controls.
  457.  
  458.    - supportedSASLMechanisms: list of supported SASL security features.
  459.  
  460.    - supportedLDAPVersion: LDAP versions implemented by the server.
  461.  
  462.    If the server does not master entries and does not know the locations
  463.    of schema information, the subschemaSubentry attribute is not present
  464.    in the root DSE.  If the server masters directory entries under one
  465.    or more schema rules, there may be any number of values of the
  466.    subschemaSubentry attribute in the root DSE.
  467.  
  468. 4.  Elements of Protocol
  469.  
  470.    The LDAP protocol is described using Abstract Syntax Notation 1
  471.    (ASN.1) [3], and is typically transferred using a subset of ASN.1
  472.    Basic Encoding Rules [11]. In order to support future extensions to
  473.    this protocol, clients and servers MUST ignore elements of SEQUENCE
  474.    encodings whose tags they do not recognize.
  475.  
  476.    Note that unlike X.500, each change to the LDAP protocol other than
  477.    through the extension mechanisms will have a different version
  478.    number.  A client will indicate the version it supports as part of
  479.    the bind request, described in section 4.2.  If a client has not sent
  480.    a bind, the server MUST assume that version 3 is supported in the
  481.    client (since version 2 required that the client bind first).
  482.  
  483.    Clients may determine the protocol version a server supports by
  484.    reading the supportedLDAPVersion attribute from the root DSE. Servers
  485.    which implement version 3 or later versions MUST provide this
  486.    attribute.  Servers which only implement version 2 may not provide
  487.    this attribute.
  488.  
  489. 4.1. Common Elements
  490.  
  491.    This section describes the LDAPMessage envelope PDU (Protocol Data
  492.    Unit) format, as well as data type definitions which are used in the
  493.    protocol operations.
  494.  
  495. 4.1.1. Message Envelope
  496.  
  497.    For the purposes of protocol exchanges, all protocol operations are
  498.    encapsulated in a common envelope, the LDAPMessage, which is defined
  499.    as follows:
  500.  
  501.         LDAPMessage ::= SEQUENCE {
  502.  
  503.  
  504.  
  505. Wahl, et. al.               Standards Track                     [Page 9]
  506.  
  507. RFC 2251                         LDAPv3                    December 1997
  508.  
  509.  
  510.                 messageID       MessageID,
  511.                 protocolOp      CHOICE {
  512.                         bindRequest     BindRequest,
  513.                         bindResponse    BindResponse,
  514.                         unbindRequest   UnbindRequest,
  515.                         searchRequest   SearchRequest,
  516.                         searchResEntry  SearchResultEntry,
  517.                         searchResDone   SearchResultDone,
  518.                         searchResRef    SearchResultReference,
  519.                         modifyRequest   ModifyRequest,
  520.                         modifyResponse  ModifyResponse,
  521.                         addRequest      AddRequest,
  522.                         addResponse     AddResponse,
  523.                         delRequest      DelRequest,
  524.                         delResponse     DelResponse,
  525.                         modDNRequest    ModifyDNRequest,
  526.                         modDNResponse   ModifyDNResponse,
  527.                         compareRequest  CompareRequest,
  528.                         compareResponse CompareResponse,
  529.                         abandonRequest  AbandonRequest,
  530.                         extendedReq     ExtendedRequest,
  531.                         extendedResp    ExtendedResponse },
  532.                  controls       [0] Controls OPTIONAL }
  533.  
  534.         MessageID ::= INTEGER (0 .. maxInt)
  535.  
  536.         maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
  537.  
  538.    The function of the LDAPMessage is to provide an envelope containing
  539.    common fields required in all protocol exchanges. At this time the
  540.    only common fields are the message ID and the controls.
  541.  
  542.    If the server receives a PDU from the client in which the LDAPMessage
  543.    SEQUENCE tag cannot be recognized, the messageID cannot be parsed,
  544.    the tag of the protocolOp is not recognized as a request, or the
  545.    encoding structures or lengths of data fields are found to be
  546.    incorrect, then the server MUST return the notice of disconnection
  547.    described in section 4.4.1, with resultCode protocolError, and
  548.    immediately close the connection. In other cases that the server
  549.    cannot parse the request received by the client, the server MUST
  550.    return an appropriate response to the request, with the resultCode
  551.    set to protocolError.
  552.  
  553.    If the client receives a PDU from the server which cannot be parsed,
  554.    the client may discard the PDU, or may abruptly close the connection.
  555.  
  556.    The ASN.1 type Controls is defined in section 4.1.12.
  557.  
  558.  
  559.  
  560.  
  561. Wahl, et. al.               Standards Track                    [Page 10]
  562.  
  563. RFC 2251                         LDAPv3                    December 1997
  564.  
  565.  
  566. 4.1.1.1. Message ID
  567.  
  568.    All LDAPMessage envelopes encapsulating responses contain the
  569.    messageID value of the corresponding request LDAPMessage.
  570.  
  571.    The message ID of a request MUST have a value different from the
  572.    values of any other requests outstanding in the LDAP session of which
  573.    this message is a part.
  574.  
  575.    A client MUST NOT send a second request with the same message ID as
  576.    an earlier request on the same connection if the client has not
  577.    received the final response from the earlier request.  Otherwise the
  578.    behavior is undefined.  Typical clients increment a counter for each
  579.    request.
  580.  
  581.    A client MUST NOT reuse the message id of an abandonRequest or of the
  582.    abandoned operation until it has received a response from the server
  583.    for another request invoked subsequent to the abandonRequest, as the
  584.    abandonRequest itself does not have a response.
  585.  
  586. 4.1.2. String Types
  587.  
  588.    The LDAPString is a notational convenience to indicate that, although
  589.    strings of LDAPString type encode as OCTET STRING types, the ISO
  590.    10646 [13] character set (a superset of Unicode) is used, encoded
  591.    following the UTF-8 algorithm [14]. Note that in the UTF-8 algorithm
  592.    characters which are the same as ASCII (0x0000 through 0x007F) are
  593.    represented as that same ASCII character in a single byte.  The other
  594.    byte values are used to form a variable-length encoding of an
  595.    arbitrary character.
  596.  
  597.         LDAPString ::= OCTET STRING
  598.  
  599.    The LDAPOID is a notational convenience to indicate that the
  600.    permitted value of this string is a (UTF-8 encoded) dotted-decimal
  601.    representation of an OBJECT IDENTIFIER.
  602.  
  603.         LDAPOID ::= OCTET STRING
  604.  
  605.    For example,
  606.  
  607.         1.3.6.1.4.1.1466.1.2.3
  608.  
  609. 4.1.3. Distinguished Name and Relative Distinguished Name
  610.  
  611.    An LDAPDN and a RelativeLDAPDN are respectively defined to be the
  612.    representation of a Distinguished Name and a Relative Distinguished
  613.    Name after encoding according to the specification in [4], such that
  614.  
  615.  
  616.  
  617. Wahl, et. al.               Standards Track                    [Page 11]
  618.  
  619. RFC 2251                         LDAPv3                    December 1997
  620.  
  621.  
  622.         <distinguished-name> ::= <name>
  623.  
  624.         <relative-distinguished-name> ::= <name-component>
  625.  
  626.    where <name> and <name-component> are as defined in [4].
  627.  
  628.         LDAPDN ::= LDAPString
  629.  
  630.         RelativeLDAPDN ::= LDAPString
  631.  
  632.    Only Attribute Types can be present in a relative distinguished name
  633.    component; the options of Attribute Descriptions (next section) MUST
  634.    NOT be used in specifying distinguished names.
  635.  
  636. 4.1.4. Attribute Type
  637.  
  638.    An AttributeType takes on as its value the textual string associated
  639.    with that AttributeType in its specification.
  640.  
  641.         AttributeType ::= LDAPString
  642.  
  643.    Each attribute type has a unique OBJECT IDENTIFIER which has been
  644.    assigned to it.  This identifier may be written as decimal digits
  645.    with components separated by periods, e.g. "2.5.4.10".
  646.  
  647.    A specification may also assign one or more textual names for an
  648.    attribute type.  These names MUST begin with a letter, and only
  649.    contain ASCII letters, digit characters and hyphens.  They are case
  650.    insensitive.  (These ASCII characters are identical to ISO 10646
  651.    characters whose UTF-8 encoding is a single byte between 0x00 and
  652.    0x7F.)
  653.  
  654.    If the server has a textual name for an attribute type, it MUST use a
  655.    textual name for attributes returned in search results.  The dotted-
  656.    decimal OBJECT IDENTIFIER is only used if there is no textual name
  657.    for an attribute type.
  658.  
  659.    Attribute type textual names are non-unique, as two different
  660.    specifications (neither in standards track RFCs) may choose the same
  661.    name.
  662.  
  663.    A server which masters or shadows entries SHOULD list all the
  664.    attribute types it supports in the subschema entries, using the
  665.    attributeTypes attribute.  Servers which support an open-ended set of
  666.    attributes SHOULD include at least the attributeTypes value for the
  667.    'objectClass' attribute. Clients MAY retrieve the attributeTypes
  668.    value from subschema entries in order to obtain the OBJECT IDENTIFIER
  669.    and other information associated with attribute types.
  670.  
  671.  
  672.  
  673. Wahl, et. al.               Standards Track                    [Page 12]
  674.  
  675. RFC 2251                         LDAPv3                    December 1997
  676.  
  677.  
  678.    Some attribute type names which are used in this version of LDAP are
  679.    described in [5].  Servers may implement additional attribute types.
  680.  
  681. 4.1.5. Attribute Description
  682.  
  683.    An AttributeDescription is a superset of the definition of the
  684.    AttributeType.  It has the same ASN.1 definition, but allows
  685.    additional options to be specified.  They are also case insensitive.
  686.  
  687.         AttributeDescription ::= LDAPString
  688.  
  689.    A value of AttributeDescription is based on the following BNF:
  690.  
  691.         <AttributeDescription> ::= <AttributeType> [ ";" <options> ]
  692.  
  693.         <options>  ::= <option> | <option> ";" <options>
  694.  
  695.         <option>   ::= <opt-char> <opt-char>*
  696.  
  697.         <opt-char> ::=  ASCII-equivalent letters, numbers and hyphen
  698.  
  699.    Examples of valid AttributeDescription:
  700.  
  701.         cn
  702.         userCertificate;binary
  703.  
  704.    One option, "binary", is defined in this document.  Additional
  705.    options may be defined in IETF standards-track and experimental RFCs.
  706.    Options beginning with "x-" are reserved for private experiments.
  707.    Any option could be associated with any AttributeType, although not
  708.    all combinations may be supported by a server.
  709.  
  710.    An AttributeDescription with one or more options is treated as a
  711.    subtype of the attribute type without any options.  Options present
  712.    in an AttributeDescription are never mutually exclusive.
  713.    Implementations MUST generate the <options> list sorted in ascending
  714.    order, and servers MUST treat any two AttributeDescription with the
  715.    same AttributeType and options as equivalent.  A server will treat an
  716.    AttributeDescription with any options it does not implement as an
  717.    unrecognized attribute type.
  718.  
  719.    The data type "AttributeDescriptionList" describes a list of 0 or
  720.    more attribute types.  (A list of zero elements has special
  721.    significance in the Search request.)
  722.  
  723.         AttributeDescriptionList ::= SEQUENCE OF
  724.                 AttributeDescription
  725.  
  726.  
  727.  
  728.  
  729. Wahl, et. al.               Standards Track                    [Page 13]
  730.  
  731. RFC 2251                         LDAPv3                    December 1997
  732.  
  733.  
  734. 4.1.5.1. Binary Option
  735.  
  736.    If the "binary" option is present in an AttributeDescription, it
  737.    overrides any string-based encoding representation defined for that
  738.    attribute in [5]. Instead the attribute is to be transferred as a
  739.    binary value encoded using the Basic Encoding Rules [11].  The syntax
  740.    of the binary value is an ASN.1 data type definition which is
  741.    referenced by the "SYNTAX" part of the attribute type definition.
  742.  
  743.    The presence or absence of the "binary" option only affects the
  744.    transfer of attribute values in protocol; servers store any
  745.    particular attribute in a single format.  If a client requests that a
  746.    server return an attribute in the binary format, but the server
  747.    cannot generate that format, the server MUST treat this attribute
  748.    type as an unrecognized attribute type.  Similarly, clients MUST NOT
  749.    expect servers to return an attribute in binary format if the client
  750.    requested that attribute by name without the binary option.
  751.  
  752.    This option is intended to be used with attributes whose syntax is a
  753.    complex ASN.1 data type, and the structure of values of that type is
  754.    needed by clients.  Examples of this kind of syntax are "Certificate"
  755.    and "CertificateList".
  756.  
  757. 4.1.6. Attribute Value
  758.  
  759.    A field of type AttributeValue takes on as its value either a string
  760.    encoding of a AttributeValue data type, or an OCTET STRING containing
  761.    an encoded binary value, depending on whether the "binary" option is
  762.    present in the companion AttributeDescription to this AttributeValue.
  763.  
  764.    The definition of string encodings for different syntaxes and types
  765.    may be found in other documents, and in particular [5].
  766.  
  767.         AttributeValue ::= OCTET STRING
  768.  
  769.    Note that there is no defined limit on the size of this encoding;
  770.    thus protocol values may include multi-megabyte attributes (e.g.
  771.    photographs).
  772.  
  773.    Attributes may be defined which have arbitrary and non-printable
  774.    syntax.  Implementations MUST NEITHER simply display nor attempt to
  775.    decode as ASN.1 a value if its syntax is not known.  The
  776.    implementation may attempt to discover the subschema of the source
  777.    entry, and retrieve the values of attributeTypes from it.
  778.  
  779.    Clients MUST NOT send attribute values in a request which are not
  780.    valid according to the syntax defined for the attributes.
  781.  
  782.  
  783.  
  784.  
  785. Wahl, et. al.               Standards Track                    [Page 14]
  786.  
  787. RFC 2251                         LDAPv3                    December 1997
  788.  
  789.  
  790. 4.1.7. Attribute Value Assertion
  791.  
  792.    The AttributeValueAssertion type definition is similar to the one in
  793.    the X.500 directory standards.  It contains an attribute description
  794.    and a matching rule assertion value suitable for that type.
  795.  
  796.         AttributeValueAssertion ::= SEQUENCE {
  797.                 attributeDesc   AttributeDescription,
  798.                 assertionValue  AssertionValue }
  799.  
  800.         AssertionValue ::= OCTET STRING
  801.  
  802.    If the "binary" option is present in attributeDesc, this signals to
  803.    the server that the assertionValue is a binary encoding of the
  804.    assertion value.
  805.  
  806.    For all the string-valued user attributes described in [5], the
  807.    assertion value syntax is the same as the value syntax.  Clients may
  808.    use attribute values as assertion values in compare requests and
  809.    search filters.
  810.  
  811.    Note however that the assertion syntax may be different from the
  812.    value syntax for other attributes or for non-equality matching rules.
  813.    These may have an assertion syntax which contains only part of the
  814.    value.  See section 20.2.1.8 of X.501 [6] for examples.
  815.  
  816. 4.1.8. Attribute
  817.  
  818.    An attribute consists of a type and one or more values of that type.
  819.    (Though attributes MUST have at least one value when stored, due to
  820.    access control restrictions the set may be empty when transferred in
  821.    protocol.  This is described in section 4.5.2, concerning the
  822.    PartialAttributeList type.)
  823.  
  824.         Attribute ::= SEQUENCE {
  825.                 type    AttributeDescription,
  826.                 vals    SET OF AttributeValue }
  827.  
  828.    Each attribute value is distinct in the set (no duplicates).  The
  829.    order of attribute values within the vals set is undefined and
  830.    implementation-dependent, and MUST NOT be relied upon.
  831.  
  832. 4.1.9. Matching Rule Identifier
  833.  
  834.    A matching rule is a means of expressing how a server should compare
  835.    an AssertionValue received in a search filter with an abstract data
  836.    value.  The matching rule defines the syntax of the assertion value
  837.    and the process to be performed in the server.
  838.  
  839.  
  840.  
  841. Wahl, et. al.               Standards Track                    [Page 15]
  842.  
  843. RFC 2251                         LDAPv3                    December 1997
  844.  
  845.  
  846.    An X.501(1993) Matching Rule is identified in the LDAP protocol by
  847.    the printable representation of its OBJECT IDENTIFIER, either as one
  848.    of the strings given in [5], or as decimal digits with components
  849.    separated by periods, e.g. "caseIgnoreIA5Match" or
  850.    "1.3.6.1.4.1.453.33.33".
  851.  
  852.         MatchingRuleId ::= LDAPString
  853.  
  854.    Servers which support matching rules for use in the extensibleMatch
  855.    search filter MUST list the matching rules they implement in
  856.    subschema entries, using the matchingRules attributes.  The server
  857.    SHOULD also list there, using the matchingRuleUse attribute, the
  858.    attribute types with which each matching rule can be used.  More
  859.    information is given in section 4.4 of [5].
  860.  
  861. 4.1.10. Result Message
  862.  
  863.    The LDAPResult is the construct used in this protocol to return
  864.    success or failure indications from servers to clients. In response
  865.    to various requests servers will return responses containing fields
  866.    of type LDAPResult to indicate the final status of a protocol
  867.    operation request.
  868.  
  869.         LDAPResult ::= SEQUENCE {
  870.                 resultCode      ENUMERATED {
  871.                              success                      (0),
  872.                              operationsError              (1),
  873.                              protocolError                (2),
  874.                              timeLimitExceeded            (3),
  875.                              sizeLimitExceeded            (4),
  876.                              compareFalse                 (5),
  877.                              compareTrue                  (6),
  878.  
  879.                              authMethodNotSupported       (7),
  880.                              strongAuthRequired           (8),
  881.                                         -- 9 reserved --
  882.                              referral                     (10),  -- new
  883.                              adminLimitExceeded           (11),  -- new
  884.                              unavailableCriticalExtension (12),  -- new
  885.                              confidentialityRequired      (13),  -- new
  886.                              saslBindInProgress           (14),  -- new
  887.                              noSuchAttribute              (16),
  888.                              undefinedAttributeType       (17),
  889.                              inappropriateMatching        (18),
  890.                              constraintViolation          (19),
  891.                              attributeOrValueExists       (20),
  892.                              invalidAttributeSyntax       (21),
  893.                                         -- 22-31 unused --
  894.  
  895.  
  896.  
  897. Wahl, et. al.               Standards Track                    [Page 16]
  898.  
  899. RFC 2251                         LDAPv3                    December 1997
  900.  
  901.  
  902.                              noSuchObject                 (32),
  903.                              aliasProblem                 (33),
  904.                              invalidDNSyntax              (34),
  905.                              -- 35 reserved for undefined isLeaf --
  906.                              aliasDereferencingProblem    (36),
  907.                                         -- 37-47 unused --
  908.                              inappropriateAuthentication  (48),
  909.                              invalidCredentials           (49),
  910.                              insufficientAccessRights     (50),
  911.                              busy                         (51),
  912.                              unavailable                  (52),
  913.                              unwillingToPerform           (53),
  914.                              loopDetect                   (54),
  915.                                         -- 55-63 unused --
  916.                              namingViolation              (64),
  917.                              objectClassViolation         (65),
  918.                              notAllowedOnNonLeaf          (66),
  919.                              notAllowedOnRDN              (67),
  920.                              entryAlreadyExists           (68),
  921.                              objectClassModsProhibited    (69),
  922.                                         -- 70 reserved for CLDAP --
  923.                              affectsMultipleDSAs          (71), -- new
  924.                                         -- 72-79 unused --
  925.                              other                        (80) },
  926.                              -- 81-90 reserved for APIs --
  927.                 matchedDN       LDAPDN,
  928.                 errorMessage    LDAPString,
  929.                 referral        [3] Referral OPTIONAL }
  930.  
  931.    All the result codes with the exception of success, compareFalse and
  932.    compareTrue are to be treated as meaning the operation could not be
  933.    completed in its entirety.
  934.  
  935.    Most of the result codes are based on problem indications from X.511
  936.    error data types.  Result codes from 16 to 21 indicate an
  937.    AttributeProblem, codes 32, 33, 34 and 36 indicate a NameProblem,
  938.    codes 48, 49 and 50 indicate a SecurityProblem, codes 51 to 54
  939.    indicate a ServiceProblem, and codes 64 to 69 and 71 indicates an
  940.    UpdateProblem.
  941.  
  942.    If a client receives a result code which is not listed above, it is
  943.    to be treated as an unknown error condition.
  944.  
  945.    The errorMessage field of this construct may, at the server's option,
  946.    be used to return a string containing a textual, human-readable
  947.    (terminal control and page formatting characters should be avoided)
  948.    error diagnostic. As this error diagnostic is not standardized,
  949.  
  950.  
  951.  
  952.  
  953. Wahl, et. al.               Standards Track                    [Page 17]
  954.  
  955. RFC 2251                         LDAPv3                    December 1997
  956.  
  957.  
  958.    implementations MUST NOT rely on the values returned.  If the server
  959.    chooses not to return a textual diagnostic, the errorMessage field of
  960.    the LDAPResult type MUST contain a zero length string.
  961.  
  962.    For result codes of noSuchObject, aliasProblem, invalidDNSyntax and
  963.    aliasDereferencingProblem, the matchedDN field is set to the name of
  964.    the lowest entry (object or alias) in the directory that was matched.
  965.    If no aliases were dereferenced while attempting to locate the entry,
  966.    this will be a truncated form of the name provided, or if aliases
  967.    were dereferenced, of the resulting name, as defined in section 12.5
  968.    of X.511 [8]. The matchedDN field is to be set to a zero length
  969.    string with all other result codes.
  970.  
  971. 4.1.11. Referral
  972.  
  973.    The referral error indicates that the contacted server does not hold
  974.    the target entry of the request.  The referral field is present in an
  975.    LDAPResult if the LDAPResult.resultCode field value is referral, and
  976.    absent with all other result codes.  It contains a reference to
  977.    another server (or set of servers) which may be accessed via LDAP or
  978.    other protocols.  Referrals can be returned in response to any
  979.    operation request (except unbind and abandon which do not have
  980.    responses). At least one URL MUST be present in the Referral.
  981.  
  982.    The referral is not returned for a singleLevel or wholeSubtree search
  983.    in which the search scope spans multiple naming contexts, and several
  984.    different servers would need to be contacted to complete the
  985.    operation. Instead, continuation references, described in section
  986.    4.5.3, are returned.
  987.  
  988.         Referral ::= SEQUENCE OF LDAPURL  -- one or more
  989.  
  990.         LDAPURL ::= LDAPString -- limited to characters permitted in URLs
  991.  
  992.    If the client wishes to progress the operation, it MUST follow the
  993.    referral by contacting any one of servers.  All the URLs MUST be
  994.    equally capable of being used to progress the operation.  (The
  995.    mechanisms for how this is achieved by multiple servers are outside
  996.    the scope of this document.)
  997.  
  998.    URLs for servers implementing the LDAP protocol are written according
  999.    to [9].  If an alias was dereferenced, the <dn> part of the URL MUST
  1000.    be present, with the new target object name.  If the <dn> part is
  1001.    present, the client MUST use this name in its next request to
  1002.    progress the operation, and if it is not present the client will use
  1003.    the same name as in the original request.  Some servers (e.g.
  1004.    participating in distributed indexing) may provide a different filter
  1005.    in a referral for a search operation.  If the filter part of the URL
  1006.  
  1007.  
  1008.  
  1009. Wahl, et. al.               Standards Track                    [Page 18]
  1010.  
  1011. RFC 2251                         LDAPv3                    December 1997
  1012.  
  1013.  
  1014.    is present in an LDAPURL, the client MUST use this filter in its next
  1015.    request to progress this search, and if it is not present the client
  1016.    MUST use the same filter as it used for that search.  Other aspects
  1017.    of the new request may be the same or different as the request which
  1018.    generated the referral.
  1019.  
  1020.    Note that UTF-8 characters appearing in a DN or search filter may not
  1021.    be legal for URLs (e.g. spaces) and MUST be escaped using the %
  1022.    method in RFC 1738 [7].
  1023.  
  1024.    Other kinds of URLs may be returned, so long as the operation could
  1025.    be performed using that protocol.
  1026.  
  1027. 4.1.12. Controls
  1028.  
  1029.    A control is a way to specify extension information. Controls which
  1030.    are sent as part of a request apply only to that request and are not
  1031.    saved.
  1032.  
  1033.         Controls ::= SEQUENCE OF Control
  1034.  
  1035.         Control ::= SEQUENCE {
  1036.                 controlType             LDAPOID,
  1037.                 criticality             BOOLEAN DEFAULT FALSE,
  1038.                 controlValue            OCTET STRING OPTIONAL }
  1039.  
  1040.    The controlType field MUST be a UTF-8 encoded dotted-decimal
  1041.    representation of an OBJECT IDENTIFIER which uniquely identifies the
  1042.    control.  This prevents conflicts between control names.
  1043.  
  1044.    The criticality field is either TRUE or FALSE.
  1045.  
  1046.    If the server recognizes the control type and it is appropriate for
  1047.    the operation, the server will make use of the control when
  1048.    performing the operation.
  1049.  
  1050.    If the server does not recognize the control type and the criticality
  1051.    field is TRUE, the server MUST NOT perform the operation, and MUST
  1052.    instead return the resultCode unsupportedCriticalExtension.
  1053.  
  1054.    If the control is not appropriate for the operation and criticality
  1055.    field is TRUE, the server MUST NOT perform the operation, and MUST
  1056.    instead return the resultCode unsupportedCriticalExtension.
  1057.  
  1058.    If the control is unrecognized or inappropriate but the criticality
  1059.    field is FALSE, the server MUST ignore the control.
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065. Wahl, et. al.               Standards Track                    [Page 19]
  1066.  
  1067. RFC 2251                         LDAPv3                    December 1997
  1068.  
  1069.  
  1070.    The controlValue contains any information associated with the
  1071.    control, and its format is defined for the control.  The server MUST
  1072.    be prepared to handle arbitrary contents of the controlValue octet
  1073.    string, including zero bytes.  It is absent only if there is no value
  1074.    information which is associated with a control of its type.
  1075.  
  1076.    This document does not define any controls.  Controls may be defined
  1077.    in other documents.  The definition of a control consists of:
  1078.  
  1079.      - the OBJECT IDENTIFIER assigned to the control,
  1080.  
  1081.      - whether the control is always noncritical, always critical, or
  1082.        critical at the client's option,
  1083.  
  1084.      - the format of the controlValue contents of the control.
  1085.  
  1086.    Servers list the controls which they recognize in the
  1087.    supportedControl attribute in the root DSE.
  1088.  
  1089. 4.2. Bind Operation
  1090.  
  1091.    The function of the Bind Operation is to allow authentication
  1092.    information to be exchanged between the client and server.
  1093.  
  1094.    The Bind Request is defined as follows:
  1095.  
  1096.         BindRequest ::= [APPLICATION 0] SEQUENCE {
  1097.                 version                 INTEGER (1 .. 127),
  1098.                 name                    LDAPDN,
  1099.                 authentication          AuthenticationChoice }
  1100.  
  1101.         AuthenticationChoice ::= CHOICE {
  1102.                 simple                  [0] OCTET STRING,
  1103.                                          -- 1 and 2 reserved
  1104.                 sasl                    [3] SaslCredentials }
  1105.  
  1106.         SaslCredentials ::= SEQUENCE {
  1107.                 mechanism               LDAPString,
  1108.                 credentials             OCTET STRING OPTIONAL }
  1109.  
  1110.    Parameters of the Bind Request are:
  1111.  
  1112.    - version: A version number indicating the version of the protocol to
  1113.      be used in this protocol session.  This document describes version
  1114.      3 of the LDAP protocol.  Note that there is no version negotiation,
  1115.      and the client just sets this parameter to the version it desires.
  1116.      If the client requests protocol version 2, a server that supports
  1117.      the version 2 protocol as described in [2] will not return any v3-
  1118.  
  1119.  
  1120.  
  1121. Wahl, et. al.               Standards Track                    [Page 20]
  1122.  
  1123. RFC 2251                         LDAPv3                    December 1997
  1124.  
  1125.  
  1126.      specific protocol fields.  (Note that not all LDAP servers will
  1127.      support protocol version 2, since they may be unable to generate
  1128.      the attribute syntaxes associated with version 2.)
  1129.  
  1130.    - name: The name of the directory object that the client wishes to
  1131.      bind as.  This field may take on a null value (a zero length
  1132.      string) for the purposes of anonymous binds, when authentication
  1133.      has been performed at a lower layer, or when using SASL credentials
  1134.      with a mechanism that includes the LDAPDN in the credentials.
  1135.  
  1136.    - authentication: information used to authenticate the name, if any,
  1137.      provided in the Bind Request.
  1138.  
  1139.    Upon receipt of a Bind Request, a protocol server will authenticate
  1140.    the requesting client, if necessary.  The server will then return a
  1141.    Bind Response to the client indicating the status of the
  1142.    authentication.
  1143.  
  1144.    Authorization is the use of this authentication information when
  1145.    performing operations.  Authorization MAY be affected by factors
  1146.    outside of the LDAP Bind request, such as lower layer security
  1147.    services.
  1148.  
  1149. 4.2.1. Sequencing of the Bind Request
  1150.  
  1151.    For some SASL authentication mechanisms, it may be necessary for the
  1152.    client to invoke the BindRequest multiple times.  If at any stage the
  1153.    client wishes to abort the bind process it MAY unbind and then drop
  1154.    the underlying connection.  Clients MUST NOT invoke operations
  1155.    between two Bind requests made as part of a multi-stage bind.
  1156.  
  1157.    A client may abort a SASL bind negotiation by sending a BindRequest
  1158.    with a different value in the mechanism field of SaslCredentials, or
  1159.    an AuthenticationChoice other than sasl.
  1160.  
  1161.    If the client sends a BindRequest with the sasl mechanism field as an
  1162.    empty string, the server MUST return a BindResponse with
  1163.    authMethodNotSupported as the resultCode.  This will allow clients to
  1164.    abort a negotiation if it wishes to try again with the same SASL
  1165.    mechanism.
  1166.  
  1167.    Unlike LDAP v2, the client need not send a Bind Request in the first
  1168.    PDU of the connection.  The client may request any operations and the
  1169.    server MUST treat these as unauthenticated. If the server requires
  1170.    that the client bind before browsing or modifying the directory, the
  1171.    server MAY reject a request other than binding, unbinding or an
  1172.    extended request with the "operationsError" result.
  1173.  
  1174.  
  1175.  
  1176.  
  1177. Wahl, et. al.               Standards Track                    [Page 21]
  1178.  
  1179. RFC 2251                         LDAPv3                    December 1997
  1180.  
  1181.  
  1182.    If the client did not bind before sending a request and receives an
  1183.    operationsError, it may then send a Bind Request.  If this also fails
  1184.    or the client chooses not to bind on the existing connection, it will
  1185.    close the connection, reopen it and begin again by first sending a
  1186.    PDU with a Bind Request.  This will aid in interoperating with
  1187.    servers implementing other versions of LDAP.
  1188.  
  1189.    Clients MAY send multiple bind requests on a connection to change
  1190.    their credentials.  A subsequent bind process has the effect of
  1191.    abandoning all operations outstanding on the connection.  (This
  1192.    simplifies server implementation.)  Authentication from earlier binds
  1193.    are subsequently ignored, and so if the bind fails, the connection
  1194.    will be treated as anonymous. If a SASL transfer encryption or
  1195.    integrity mechanism has been negotiated, and that mechanism does not
  1196.    support the changing of credentials from one identity to another,
  1197.    then the client MUST instead establish a new connection.
  1198.  
  1199. 4.2.2. Authentication and Other Security Services
  1200.  
  1201.    The simple authentication option provides minimal authentication
  1202.    facilities, with the contents of the authentication field consisting
  1203.    only of a cleartext password.  Note that the use of cleartext
  1204.    passwords is not recommended over open networks when there is no
  1205.    authentication or encryption being performed by a lower layer; see
  1206.    the "Security Considerations" section.
  1207.  
  1208.    If no authentication is to be performed, then the simple
  1209.    authentication option MUST be chosen, and the password be of zero
  1210.    length.  (This is often done by LDAPv2 clients.)  Typically the DN is
  1211.    also of zero length.
  1212.  
  1213.    The sasl choice allows for any mechanism defined for use with SASL
  1214.    [12].  The mechanism field contains the name of the mechanism.  The
  1215.    credentials field contains the arbitrary data used for
  1216.    authentication, inside an OCTET STRING wrapper.  Note that unlike
  1217.    some Internet application protocols where SASL is used, LDAP is not
  1218.    text-based, thus no base64 transformations are performed on the
  1219.    credentials.
  1220.  
  1221.    If any SASL-based integrity or confidentiality services are enabled,
  1222.    they take effect following the transmission by the server and
  1223.    reception by the client of the final BindResponse with resultCode
  1224.    success.
  1225.  
  1226.    The client can request that the server use authentication information
  1227.    from a lower layer protocol by using the SASL EXTERNAL mechanism.
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233. Wahl, et. al.               Standards Track                    [Page 22]
  1234.  
  1235. RFC 2251                         LDAPv3                    December 1997
  1236.  
  1237.  
  1238. 4.2.3. Bind Response
  1239.  
  1240.    The Bind Response is defined as follows.
  1241.  
  1242.         BindResponse ::= [APPLICATION 1] SEQUENCE {
  1243.              COMPONENTS OF LDAPResult,
  1244.              serverSaslCreds    [7] OCTET STRING OPTIONAL }
  1245.  
  1246.     BindResponse consists simply of an indication from the server of he
  1247.    status of the client's request for authentication.
  1248.  
  1249.    f the bind was successful, the resultCode will be success, therwise
  1250.    it will be one of:
  1251.  
  1252.    - operationsError: server encountered an internal error,
  1253.  
  1254.    - protocolError: unrecognized version number or incorrect PDU
  1255.      structure,
  1256.  
  1257.    - authMethodNotSupported: unrecognized SASL mechanism name,
  1258.  
  1259.    - strongAuthRequired: the server requires authentication be
  1260.      performed with a SASL mechanism,
  1261.  
  1262.    - referral: this server cannot accept this bind and the client
  1263.      should try another,
  1264.  
  1265.    - saslBindInProgress: the server requires the client to send a
  1266.      new bind request, with the same sasl mechanism, to continue the
  1267.      authentication process,
  1268.  
  1269.    - inappropriateAuthentication: the server requires the client
  1270.      which had attempted to bind anonymously or without supplying
  1271.      credentials to provide some form of credentials,
  1272.  
  1273.    - invalidCredentials: the wrong password was supplied or the SASL
  1274.      credentials could not be processed,
  1275.  
  1276.    - unavailable: the server is shutting down.
  1277.  
  1278.    If the server does not support the client's requested protocol
  1279.    version, it MUST set the resultCode to protocolError.
  1280.  
  1281.    If the client receives a BindResponse response where the resultCode
  1282.    was protocolError, it MUST close the connection as the server will be
  1283.    unwilling to accept further operations.  (This is for compatibility
  1284.    with earlier versions of LDAP, in which the bind was always the first
  1285.    operation, and there was no negotiation.)
  1286.  
  1287.  
  1288.  
  1289. Wahl, et. al.               Standards Track                    [Page 23]
  1290.  
  1291. RFC 2251                         LDAPv3                    December 1997
  1292.  
  1293.  
  1294.    The serverSaslCreds are used as part of a SASL-defined bind mechanism
  1295.    to allow the client to authenticate the server to which it is
  1296.    communicating, or to perform "challenge-response" authentication. If
  1297.    the client bound with the password choice, or the SASL mechanism does
  1298.    not require the server to return information to the client, then this
  1299.    field is not to be included in the result.
  1300.  
  1301. 4.3. Unbind Operation
  1302.  
  1303.    The function of the Unbind Operation is to terminate a protocol
  1304.    session.  The Unbind Operation is defined as follows:
  1305.  
  1306.         UnbindRequest ::= [APPLICATION 2] NULL
  1307.  
  1308.    The Unbind Operation has no response defined. Upon transmission of an
  1309.    UnbindRequest, a protocol client may assume that the protocol session
  1310.    is terminated. Upon receipt of an UnbindRequest, a protocol server
  1311.    may assume that the requesting client has terminated the session and
  1312.    that all outstanding requests may be discarded, and may close the
  1313.    connection.
  1314.  
  1315. 4.4. Unsolicited Notification
  1316.  
  1317.    An unsolicited notification is an LDAPMessage sent from the server to
  1318.    the client which is not in response to any LDAPMessage received by
  1319.    the server. It is used to signal an extraordinary condition in the
  1320.    server or in the connection between the client and the server.  The
  1321.    notification is of an advisory nature, and the server will not expect
  1322.    any response to be returned from the client.
  1323.  
  1324.    The unsolicited notification is structured as an LDAPMessage in which
  1325.    the messageID is 0 and protocolOp is of the extendedResp form.  The
  1326.    responseName field of the ExtendedResponse is present. The LDAPOID
  1327.    value MUST be unique for this notification, and not be used in any
  1328.    other situation.
  1329.  
  1330.    One unsolicited notification is defined in this document.
  1331.  
  1332. 4.4.1. Notice of Disconnection
  1333.  
  1334.    This notification may be used by the server to advise the client that
  1335.    the server is about to close the connection due to an error
  1336.    condition.  Note that this notification is NOT a response to an
  1337.    unbind requested by the client: the server MUST follow the procedures
  1338.    of section 4.3. This notification is intended to assist clients in
  1339.    distinguishing between an error condition and a transient network
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345. Wahl, et. al.               Standards Track                    [Page 24]
  1346.  
  1347. RFC 2251                         LDAPv3                    December 1997
  1348.  
  1349.  
  1350.    failure.  As with a connection close due to network failure, the
  1351.    client MUST NOT assume that any outstanding requests which modified
  1352.    the directory have succeeded or failed.
  1353.  
  1354.    The responseName is 1.3.6.1.4.1.1466.20036, the response field is
  1355.    absent, and the resultCode is used to indicate the reason for the
  1356.    disconnection.
  1357.  
  1358.    The following resultCode values are to be used in this notification:
  1359.  
  1360.    - protocolError: The server has received data from the client in
  1361.    which
  1362.      the LDAPMessage structure could not be parsed.
  1363.  
  1364.    - strongAuthRequired: The server has detected that an established
  1365.      underlying security association protecting communication between
  1366.      the client and server has unexpectedly failed or been compromised.
  1367.  
  1368.    - unavailable: This server will stop accepting new connections and
  1369.      operations on all existing connections, and be unavailable for an
  1370.      extended period of time.  The client may make use of an alternative
  1371.      server.
  1372.  
  1373.    After sending this notice, the server MUST close the connection.
  1374.    After receiving this notice, the client MUST NOT transmit any further
  1375.    on the connection, and may abruptly close the connection.
  1376.  
  1377. 4.5. Search Operation
  1378.  
  1379.    The Search Operation allows a client to request that a search be
  1380.    performed on its behalf by a server.  This can be used to read
  1381.    attributes from a single entry, from entries immediately below a
  1382.    particular entry, or a whole subtree of entries.
  1383.  
  1384. 4.5.1. Search Request
  1385.  
  1386.    The Search Request is defined as follows:
  1387.  
  1388.         SearchRequest ::= [APPLICATION 3] SEQUENCE {
  1389.                 baseObject      LDAPDN,
  1390.                 scope           ENUMERATED {
  1391.                         baseObject              (0),
  1392.                         singleLevel             (1),
  1393.                         wholeSubtree            (2) },
  1394.                 derefAliases    ENUMERATED {
  1395.                         neverDerefAliases       (0),
  1396.                         derefInSearching        (1),
  1397.                         derefFindingBaseObj     (2),
  1398.  
  1399.  
  1400.  
  1401. Wahl, et. al.               Standards Track                    [Page 25]
  1402.  
  1403. RFC 2251                         LDAPv3                    December 1997
  1404.  
  1405.  
  1406.                         derefAlways             (3) },
  1407.                 sizeLimit       INTEGER (0 .. maxInt),
  1408.                 timeLimit       INTEGER (0 .. maxInt),
  1409.                 typesOnly       BOOLEAN,
  1410.                 filter          Filter,
  1411.                 attributes      AttributeDescriptionList }
  1412.  
  1413.         Filter ::= CHOICE {
  1414.                 and             [0] SET OF Filter,
  1415.                 or              [1] SET OF Filter,
  1416.                 not             [2] Filter,
  1417.                 equalityMatch   [3] AttributeValueAssertion,
  1418.                 substrings      [4] SubstringFilter,
  1419.                 greaterOrEqual  [5] AttributeValueAssertion,
  1420.                 lessOrEqual     [6] AttributeValueAssertion,
  1421.                 present         [7] AttributeDescription,
  1422.                 approxMatch     [8] AttributeValueAssertion,
  1423.                 extensibleMatch [9] MatchingRuleAssertion }
  1424.  
  1425.         SubstringFilter ::= SEQUENCE {
  1426.                 type            AttributeDescription,
  1427.                 -- at least one must be present
  1428.                 substrings      SEQUENCE OF CHOICE {
  1429.                         initial [0] LDAPString,
  1430.                         any     [1] LDAPString,
  1431.                         final   [2] LDAPString } }
  1432.  
  1433.         MatchingRuleAssertion ::= SEQUENCE {
  1434.                 matchingRule    [1] MatchingRuleId OPTIONAL,
  1435.                 type            [2] AttributeDescription OPTIONAL,
  1436.                 matchValue      [3] AssertionValue,
  1437.                 dnAttributes    [4] BOOLEAN DEFAULT FALSE }
  1438.  
  1439.    Parameters of the Search Request are:
  1440.  
  1441.    - baseObject: An LDAPDN that is the base object entry relative to
  1442.      which the search is to be performed.
  1443.  
  1444.    - scope: An indicator of the scope of the search to be performed. The
  1445.      semantics of the possible values of this field are identical to the
  1446.      semantics of the scope field in the X.511 Search Operation.
  1447.  
  1448.    - derefAliases: An indicator as to how alias objects (as defined in
  1449.      X.501) are to be handled in searching.  The semantics of the
  1450.      possible values of this field are:
  1451.  
  1452.              neverDerefAliases: do not dereference aliases in searching
  1453.              or in locating the base object of the search;
  1454.  
  1455.  
  1456.  
  1457. Wahl, et. al.               Standards Track                    [Page 26]
  1458.  
  1459. RFC 2251                         LDAPv3                    December 1997
  1460.  
  1461.  
  1462.              derefInSearching: dereference aliases in subordinates of
  1463.              the base object in searching, but not in locating the
  1464.              base object of the search;
  1465.  
  1466.              derefFindingBaseObj: dereference aliases in locating
  1467.              the base object of the search, but not when searching
  1468.              subordinates of the base object;
  1469.  
  1470.              derefAlways: dereference aliases both in searching and in
  1471.              locating the base object of the search.
  1472.  
  1473.    - sizelimit: A sizelimit that restricts the maximum number of entries
  1474.      to be returned as a result of the search. A value of 0 in this
  1475.      field indicates that no client-requested sizelimit restrictions are
  1476.      in effect for the search.  Servers may enforce a maximum number of
  1477.      entries to return.
  1478.  
  1479.    - timelimit: A timelimit that restricts the maximum time (in seconds)
  1480.      allowed for a search. A value of 0 in this field indicates that no
  1481.      client-requested timelimit restrictions are in effect for the
  1482.      search.
  1483.  
  1484.    - typesOnly: An indicator as to whether search results will contain
  1485.      both attribute types and values, or just attribute types.  Setting
  1486.      this field to TRUE causes only attribute types (no values) to be
  1487.      returned.  Setting this field to FALSE causes both attribute types
  1488.      and values to be returned.
  1489.  
  1490.    - filter: A filter that defines the conditions that must be fulfilled
  1491.      in order for the search to match a given entry.
  1492.  
  1493.      The 'and', 'or' and 'not' choices can be used to form combinations of
  1494.      filters. At least one filter element MUST be present in an 'and' or
  1495.      'or' choice.  The others match against individual attribute values of
  1496.      entries in the scope of the search.  (Implementor's note: the 'not'
  1497.      filter is an example of a tagged choice in an implicitly-tagged
  1498.      module.  In BER this is treated as if the tag was explicit.)
  1499.  
  1500.      A server MUST evaluate filters according to the three-valued logic
  1501.      of X.511(93) section 7.8.1.  In summary, a filter is evaluated to
  1502.      either "TRUE", "FALSE" or "Undefined".  If the filter evaluates
  1503.      to TRUE for a particular entry, then the attributes of that entry
  1504.      are returned as part of the search result (subject to any applicable
  1505.      access control restrictions). If the filter evaluates to FALSE or
  1506.      Undefined, then the entry is ignored for the search.
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513. Wahl, et. al.               Standards Track                    [Page 27]
  1514.  
  1515. RFC 2251                         LDAPv3                    December 1997
  1516.  
  1517.  
  1518.      A filter of the "and" choice is TRUE if all the filters in the SET
  1519.      OF evaluate to TRUE, FALSE if at least one filter is FALSE, and
  1520.      otherwise Undefined.  A filter of the "or" choice is FALSE if all
  1521.      of the filters in the SET OF evaluate to FALSE, TRUE if at least
  1522.      one filter is TRUE, and Undefined otherwise.  A filter of the "not"
  1523.      choice is TRUE if the filter being negated is FALSE, FALSE if it is
  1524.      TRUE, and Undefined if it is Undefined.
  1525.  
  1526.      The present match evaluates to TRUE where there is an attribute or
  1527.      subtype of the specified attribute description present in an entry,
  1528.      and FALSE otherwise (including a presence test with an unrecognized
  1529.      attribute description.)
  1530.  
  1531.      The extensibleMatch is new in this version of LDAP.  If the
  1532.      matchingRule field is absent, the type field MUST be present, and
  1533.      the equality match is performed for that type.  If the type field is
  1534.      absent and matchingRule is present, the matchValue is compared
  1535.      against all attributes in an entry which support that matchingRule,
  1536.      and the matchingRule determines the syntax for the assertion value
  1537.      (the filter item evaluates to TRUE if it matches with at least
  1538.      one attribute in the entry, FALSE if it does not match any attribute
  1539.      in the entry, and Undefined if the matchingRule is not recognized
  1540.      or the assertionValue cannot be parsed.)  If the type field is
  1541.      present and matchingRule is present, the matchingRule MUST be one
  1542.      permitted for use with that type, otherwise the filter item is
  1543.      undefined.  If the dnAttributes field is set to TRUE, the match is
  1544.      applied against all the attributes in an entry's distinguished name
  1545.      as well, and also evaluates to TRUE if there is at least one
  1546.      attribute in the distinguished name for which the filter item
  1547.      evaluates to TRUE.  (Editors note: The dnAttributes field is present
  1548.      so that there does not need to be multiple versions of generic
  1549.      matching rules such as for word matching, one to apply to entries
  1550.      and another to apply to entries and dn attributes as well).
  1551.  
  1552.      A filter item evaluates to Undefined when the server would not
  1553.      be able to determine whether the assertion value matches an
  1554.      entry.  If an attribute description in an equalityMatch, substrings,
  1555.      greaterOrEqual, lessOrEqual, approxMatch or extensibleMatch
  1556.      filter is not recognized by the server, a matching rule id in the
  1557.      extensibleMatch is not recognized by the server, the assertion
  1558.      value cannot be parsed, or the type of filtering requested is not
  1559.      implemented, then the filter is Undefined.  Thus for example if a
  1560.      server did not recognize the attribute type shoeSize, a filter of
  1561.      (shoeSize=*) would evaluate to FALSE, and the filters (shoeSize=12),
  1562.      (shoeSize>=12) and (shoeSize<=12) would evaluate to Undefined.
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569. Wahl, et. al.               Standards Track                    [Page 28]
  1570.  
  1571. RFC 2251                         LDAPv3                    December 1997
  1572.  
  1573.  
  1574.      Servers MUST NOT return errors if attribute descriptions or matching
  1575.      rule ids are not recognized, or assertion values cannot be parsed.
  1576.      More details of filter processing are given in section 7.8 of X.511
  1577.      [8].
  1578.  
  1579.    - attributes: A list of the attributes to be returned from each entry
  1580.      which matches the search filter. There are two special values which
  1581.      may be used: an empty list with no attributes, and the attribute
  1582.      description string "*".  Both of these signify that all user
  1583.      attributes are to be returned.  (The "*" allows the client to
  1584.      request all user attributes in addition to specific operational
  1585.      attributes).
  1586.  
  1587.      Attributes MUST be named at most once in the list, and are returned
  1588.      at most once in an entry.   If there are attribute descriptions in
  1589.      the list which are not recognized, they are ignored by the server.
  1590.  
  1591.      If the client does not want any attributes returned, it can specify
  1592.      a list containing only the attribute with OID "1.1".  This OID was
  1593.      chosen arbitrarily and does not correspond to any attribute in use.
  1594.  
  1595.      Client implementors should note that even if all user attributes are
  1596.      requested, some attributes of the entry may not be included in
  1597.      search results due to access control or other restrictions.
  1598.      Furthermore, servers will not return operational attributes, such
  1599.      as objectClasses or attributeTypes, unless they are listed by name,
  1600.      since there may be extremely large number of values for certain
  1601.      operational attributes. (A list of operational attributes for use
  1602.      in LDAP is given in [5].)
  1603.  
  1604.    Note that an X.500 "list"-like operation can be emulated by the client
  1605.    requesting a one-level LDAP search operation with a filter checking
  1606.    for the existence of the objectClass attribute, and that an X.500
  1607.    "read"-like operation can be emulated by a base object LDAP search
  1608.    operation with the same filter.  A server which provides a gateway to
  1609.    X.500 is not required to use the Read or List operations, although it
  1610.    may choose to do so, and if it does must provide the same semantics
  1611.    as the X.500 search operation.
  1612.  
  1613. 4.5.2. Search Result
  1614.  
  1615.    The results of the search attempted by the server upon receipt of a
  1616.    Search Request are returned in Search Responses, which are LDAP
  1617.    messages containing either SearchResultEntry, SearchResultReference,
  1618.    ExtendedResponse or SearchResultDone data types.
  1619.  
  1620.         SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
  1621.                 objectName      LDAPDN,
  1622.  
  1623.  
  1624.  
  1625. Wahl, et. al.               Standards Track                    [Page 29]
  1626.  
  1627. RFC 2251                         LDAPv3                    December 1997
  1628.  
  1629.  
  1630.                 attributes      PartialAttributeList }
  1631.  
  1632.         PartialAttributeList ::= SEQUENCE OF SEQUENCE {
  1633.                 type    AttributeDescription,
  1634.                 vals    SET OF AttributeValue }
  1635.         -- implementors should note that the PartialAttributeList may
  1636.         -- have zero elements (if none of the attributes of that entry
  1637.         -- were requested, or could be returned), and that the vals set
  1638.         -- may also have zero elements (if types only was requested, or
  1639.         -- all values were excluded from the result.)
  1640.  
  1641.         SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
  1642.         -- at least one LDAPURL element must be present
  1643.  
  1644.         SearchResultDone ::= [APPLICATION 5] LDAPResult
  1645.  
  1646.    Upon receipt of a Search Request, a server will perform the necessary
  1647.    search of the DIT.
  1648.  
  1649.    If the LDAP session is operating over a connection-oriented transport
  1650.    such as TCP, the server will return to the client a sequence of
  1651.    responses in separate LDAP messages.  There may be zero or more
  1652.    responses containing SearchResultEntry, one for each entry found
  1653.    during the search.  There may also be zero or more responses
  1654.    containing SearchResultReference, one for each area not explored by
  1655.    this server during the search.  The SearchResultEntry and
  1656.    SearchResultReference PDUs may come in any order. Following all the
  1657.    SearchResultReference responses and all SearchResultEntry responses
  1658.    to be returned by the server, the server will return a response
  1659.    containing the SearchResultDone, which contains an indication of
  1660.    success, or detailing any errors that have occurred.
  1661.  
  1662.    Each entry returned in a SearchResultEntry will contain all
  1663.    attributes, complete with associated values if necessary, as
  1664.    specified in the attributes field of the Search Request.  Return of
  1665.    attributes is subject to access control and other administrative
  1666.    policy.  Some attributes may be returned in binary format (indicated
  1667.    by the AttributeDescription in the response having the binary option
  1668.    present).
  1669.  
  1670.    Some attributes may be constructed by the server and appear in a
  1671.    SearchResultEntry attribute list, although they are not stored
  1672.    attributes of an entry. Clients MUST NOT assume that all attributes
  1673.    can be modified, even if permitted by access control.
  1674.  
  1675.    LDAPMessage responses of the ExtendedResponse form are reserved for
  1676.    returning information associated with a control requested by the
  1677.    client.  These may be defined in future versions of this document.
  1678.  
  1679.  
  1680.  
  1681. Wahl, et. al.               Standards Track                    [Page 30]
  1682.  
  1683. RFC 2251                         LDAPv3                    December 1997
  1684.  
  1685.  
  1686. 4.5.3. Continuation References in the Search Result
  1687.  
  1688.    If the server was able to locate the entry referred to by the
  1689.    baseObject but was unable to search all the entries in the scope at
  1690.    and under the baseObject, the server may return one or more
  1691.    SearchResultReference, each containing a reference to another set of
  1692.    servers for continuing the operation.  A server MUST NOT return any
  1693.    SearchResultReference if it has not located the baseObject and
  1694.    thus has not searched any entries; in this case it would return a
  1695.    SearchResultDone containing a referral resultCode.
  1696.  
  1697.    In the absence of indexing information provided to a server from
  1698.    servers holding subordinate naming contexts, SearchResultReference
  1699.    responses are not affected by search filters and are always returned
  1700.    when in scope.
  1701.  
  1702.    The SearchResultReference is of the same data type as the Referral.
  1703.    URLs for servers implementing the LDAP protocol are written according
  1704.    to [9].  The <dn> part MUST be present in the URL, with the new target
  1705.    object name.  The client MUST use this name in its next request.
  1706.    Some servers (e.g. part of a distributed index exchange system) may
  1707.    provide a different filter in the URLs of the SearchResultReference.
  1708.    If the filter part of the URL is present in an LDAP URL, the client
  1709.    MUST use the new filter in its next request to progress the search,
  1710.    and if the filter part is absent the client will use again the same
  1711.    filter.  Other aspects of the new search request may be the same or
  1712.    different as the search which generated the continuation references.
  1713.  
  1714.    Other kinds of URLs may be returned so long as the operation could be
  1715.    performed using that protocol.
  1716.  
  1717.    The name of an unexplored subtree in a SearchResultReference need not
  1718.    be subordinate to the base object.
  1719.  
  1720.    In order to complete the search, the client MUST issue a new search
  1721.    operation for each SearchResultReference that is returned.  Note that
  1722.    the abandon operation described in section 4.11 applies only to a
  1723.    particular operation sent on a connection between a client and server,
  1724.    and if the client has multiple outstanding search operations to
  1725.    different servers, it MUST abandon each operation individually.
  1726.  
  1727. 4.5.3.1. Example
  1728.  
  1729.    For example, suppose the contacted server (hosta) holds the entry
  1730.    "O=MNN,C=WW" and the entry "CN=Manager,O=MNN,C=WW".  It knows that
  1731.    either LDAP-capable servers (hostb) or (hostc) hold
  1732.    "OU=People,O=MNN,C=WW" (one is the master and the other server a
  1733.  
  1734.  
  1735.  
  1736.  
  1737. Wahl, et. al.               Standards Track                    [Page 31]
  1738.  
  1739. RFC 2251                         LDAPv3                    December 1997
  1740.  
  1741.  
  1742.    shadow), and that LDAP-capable server (hostd) holds the subtree
  1743.    "OU=Roles,O=MNN,C=WW".  If a subtree search of "O=MNN,C=WW" is
  1744.    requested to the contacted server, it may return the following:
  1745.  
  1746.      SearchResultEntry for O=MNN,C=WW
  1747.      SearchResultEntry for CN=Manager,O=MNN,C=WW
  1748.      SearchResultReference {
  1749.        ldap://hostb/OU=People,O=MNN,C=WW
  1750.        ldap://hostc/OU=People,O=MNN,C=WW
  1751.      }
  1752.      SearchResultReference {
  1753.        ldap://hostd/OU=Roles,O=MNN,C=WW
  1754.      }
  1755.      SearchResultDone (success)
  1756.  
  1757.    Client implementors should note that when following a
  1758.    SearchResultReference, additional SearchResultReference may be
  1759.    generated.  Continuing the example, if the client contacted the
  1760.    server (hostb) and issued the search for the subtree
  1761.    "OU=People,O=MNN,C=WW", the server might respond as follows:
  1762.  
  1763.      SearchResultEntry for OU=People,O=MNN,C=WW
  1764.      SearchResultReference {
  1765.       ldap://hoste/OU=Managers,OU=People,O=MNN,C=WW
  1766.      }
  1767.      SearchResultReference {
  1768.       ldap://hostf/OU=Consultants,OU=People,O=MNN,C=WW
  1769.      }
  1770.      SearchResultDone (success)
  1771.  
  1772.    If the contacted server does not hold the base object for the search,
  1773.    then it will return a referral to the client.  For example, if the
  1774.    client requests a subtree search of "O=XYZ,C=US" to hosta, the server
  1775.    may return only a SearchResultDone containing a referral.
  1776.  
  1777.      SearchResultDone (referral) {
  1778.        ldap://hostg/
  1779.      }
  1780.  
  1781. 4.6. Modify Operation
  1782.  
  1783.    The Modify Operation allows a client to request that a modification
  1784.    of an entry be performed on its behalf by a server.  The Modify
  1785.    Request is defined as follows:
  1786.  
  1787.         ModifyRequest ::= [APPLICATION 6] SEQUENCE {
  1788.                 object          LDAPDN,
  1789.                 modification    SEQUENCE OF SEQUENCE {
  1790.  
  1791.  
  1792.  
  1793. Wahl, et. al.               Standards Track                    [Page 32]
  1794.  
  1795. RFC 2251                         LDAPv3                    December 1997
  1796.  
  1797.  
  1798.                         operation       ENUMERATED {
  1799.                                                 add     (0),
  1800.                                                 delete  (1),
  1801.                                                 replace (2) },
  1802.                         modification    AttributeTypeAndValues } }
  1803.  
  1804.         AttributeTypeAndValues ::= SEQUENCE {
  1805.                 type    AttributeDescription,
  1806.                 vals    SET OF AttributeValue }
  1807.  
  1808.    Parameters of the Modify Request are:
  1809.  
  1810.    - object: The object to be modified. The value of this field contains
  1811.      the DN of the entry to be modified.  The server will not perform
  1812.      any alias dereferencing in determining the object to be modified.
  1813.  
  1814.    - modification: A list of modifications to be performed on the entry.
  1815.      The entire list of entry modifications MUST be performed
  1816.      in the order they are listed, as a single atomic operation.  While
  1817.      individual modifications may violate the directory schema, the
  1818.      resulting entry after the entire list of modifications is performed
  1819.      MUST conform to the requirements of the directory schema. The
  1820.      values that may be taken on by the 'operation' field in each
  1821.      modification construct have the following semantics respectively:
  1822.  
  1823.              add: add values listed to the given attribute, creating
  1824.              the attribute if necessary;
  1825.  
  1826.              delete: delete values listed from the given attribute,
  1827.              removing the entire attribute if no values are listed, or
  1828.              if all current values of the attribute are listed for
  1829.              deletion;
  1830.  
  1831.              replace: replace all existing values of the given attribute
  1832.              with the new values listed, creating the attribute if it
  1833.              did not already exist.  A replace with no value will delete
  1834.              the entire attribute if it exists, and is ignored if the
  1835.              attribute does not exist.
  1836.  
  1837.    The result of the modify attempted by the server upon receipt of a
  1838.    Modify Request is returned in a Modify Response, defined as follows:
  1839.  
  1840.         ModifyResponse ::= [APPLICATION 7] LDAPResult
  1841.  
  1842.    Upon receipt of a Modify Request, a server will perform the necessary
  1843.    modifications to the DIT.
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849. Wahl, et. al.               Standards Track                    [Page 33]
  1850.  
  1851. RFC 2251                         LDAPv3                    December 1997
  1852.  
  1853.  
  1854.    The server will return to the client a single Modify Response
  1855.    indicating either the successful completion of the DIT modification,
  1856.    or the reason that the modification failed. Note that due to the
  1857.    requirement for atomicity in applying the list of modifications in
  1858.    the Modify Request, the client may expect that no modifications of
  1859.    the DIT have been performed if the Modify Response received indicates
  1860.    any sort of error, and that all requested modifications have been
  1861.    performed if the Modify Response indicates successful completion of
  1862.    the Modify Operation.  If the connection fails, whether the
  1863.    modification occurred or not is indeterminate.
  1864.  
  1865.    The Modify Operation cannot be used to remove from an entry any of
  1866.    its distinguished values, those values which form the entry's
  1867.    relative distinguished name.  An attempt to do so will result in the
  1868.    server returning the error notAllowedOnRDN.  The Modify DN Operation
  1869.    described in section 4.9 is used to rename an entry.
  1870.  
  1871.    If an equality match filter has not been defined for an attribute type,
  1872.    clients MUST NOT attempt to delete individual values of that attribute
  1873.    from an entry using the "delete" form of a modification, and MUST
  1874.    instead use the "replace" form.
  1875.  
  1876.    Note that due to the simplifications made in LDAP, there is not a
  1877.    direct mapping of the modifications in an LDAP ModifyRequest onto the
  1878.    EntryModifications of a DAP ModifyEntry operation, and different
  1879.    implementations of LDAP-DAP gateways may use different means of
  1880.    representing the change.  If successful, the final effect of the
  1881.    operations on the entry MUST be identical.
  1882.  
  1883. 4.7. Add Operation
  1884.  
  1885.    The Add Operation allows a client to request the addition of an entry
  1886.    into the directory. The Add Request is defined as follows:
  1887.  
  1888.         AddRequest ::= [APPLICATION 8] SEQUENCE {
  1889.                 entry           LDAPDN,
  1890.                 attributes      AttributeList }
  1891.  
  1892.         AttributeList ::= SEQUENCE OF SEQUENCE {
  1893.                 type    AttributeDescription,
  1894.                 vals    SET OF AttributeValue }
  1895.  
  1896.    Parameters of the Add Request are:
  1897.  
  1898.    - entry: the Distinguished Name of the entry to be added. Note that
  1899.      the server will not dereference any aliases in locating the entry
  1900.      to be added.
  1901.  
  1902.  
  1903.  
  1904.  
  1905. Wahl, et. al.               Standards Track                    [Page 34]
  1906.  
  1907. RFC 2251                         LDAPv3                    December 1997
  1908.  
  1909.  
  1910.    - attributes: the list of attributes that make up the content of the
  1911.      entry being added.  Clients MUST include distinguished values
  1912.      (those forming the entry's own RDN) in this list, the objectClass
  1913.      attribute, and values of any mandatory attributes of the listed
  1914.      object classes.  Clients MUST NOT supply the createTimestamp or
  1915.      creatorsName attributes, since these will be generated
  1916.      automatically by the server.
  1917.  
  1918.    The entry named in the entry field of the AddRequest MUST NOT exist
  1919.    for the AddRequest to succeed.  The parent of the entry to be added
  1920.    MUST exist.  For example, if the client attempted to add
  1921.    "CN=JS,O=Foo,C=US", the "O=Foo,C=US" entry did not exist, and the
  1922.    "C=US" entry did exist, then the server would return the error
  1923.    noSuchObject with the matchedDN field containing "C=US".  If the
  1924.    parent entry exists but is not in a naming context held by the
  1925.    server, the server SHOULD return a referral to the server holding the
  1926.    parent entry.
  1927.  
  1928.    Servers implementations SHOULD NOT restrict where entries can be
  1929.    located in the directory.  Some servers MAY allow the administrator
  1930.    to restrict the classes of entries which can be added to the
  1931.    directory.
  1932.  
  1933.    Upon receipt of an Add Request, a server will attempt to perform the
  1934.    add requested.  The result of the add attempt will be returned to the
  1935.    client in the Add Response, defined as follows:
  1936.  
  1937.         AddResponse ::= [APPLICATION 9] LDAPResult
  1938.  
  1939.    A response of success indicates that the new entry is present in the
  1940.    directory.
  1941.  
  1942. 4.8. Delete Operation
  1943.  
  1944.    The Delete Operation allows a client to request the removal of an
  1945.    entry from the directory. The Delete Request is defined as follows:
  1946.  
  1947.         DelRequest ::= [APPLICATION 10] LDAPDN
  1948.  
  1949.    The Delete Request consists of the Distinguished Name of the entry to
  1950.    be deleted. Note that the server will not dereference aliases while
  1951.    resolving the name of the target entry to be removed, and that only
  1952.    leaf entries (those with no subordinate entries) can be deleted with
  1953.    this operation.
  1954.  
  1955.    The result of the delete attempted by the server upon receipt of a
  1956.    Delete Request is returned in the Delete Response, defined as
  1957.    follows:
  1958.  
  1959.  
  1960.  
  1961. Wahl, et. al.               Standards Track                    [Page 35]
  1962.  
  1963. RFC 2251                         LDAPv3                    December 1997
  1964.  
  1965.  
  1966.         DelResponse ::= [APPLICATION 11] LDAPResult
  1967.  
  1968.    Upon receipt of a Delete Request, a server will attempt to perform
  1969.    the entry removal requested. The result of the delete attempt will be
  1970.    returned to the client in the Delete Response.
  1971.  
  1972. 4.9. Modify DN Operation
  1973.  
  1974.    The Modify DN Operation allows a client to change the leftmost (least
  1975.    significant) component of the name of an entry in the directory, or
  1976.    to move a subtree of entries to a new location in the directory.  The
  1977.    Modify DN Request is defined as follows:
  1978.  
  1979.         ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
  1980.                 entry           LDAPDN,
  1981.                 newrdn          RelativeLDAPDN,
  1982.                 deleteoldrdn    BOOLEAN,
  1983.                 newSuperior     [0] LDAPDN OPTIONAL }
  1984.  
  1985.    Parameters of the Modify DN Request are:
  1986.  
  1987.    - entry: the Distinguished Name of the entry to be changed.  This
  1988.      entry may or may not have subordinate entries.
  1989.  
  1990.    - newrdn: the RDN that will form the leftmost component of the new
  1991.      name of the entry.
  1992.  
  1993.    - deleteoldrdn: a boolean parameter that controls whether the old RDN
  1994.      attribute values are to be retained as attributes of the entry, or
  1995.      deleted from the entry.
  1996.  
  1997.    - newSuperior: if present, this is the Distinguished Name of the entry
  1998.      which becomes the immediate superior of the existing entry.
  1999.  
  2000.    The result of the name change attempted by the server upon receipt of
  2001.    a Modify DN Request is returned in the Modify DN Response, defined
  2002.    as follows:
  2003.  
  2004.         ModifyDNResponse ::= [APPLICATION 13] LDAPResult
  2005.  
  2006.    Upon receipt of a ModifyDNRequest, a server will attempt to
  2007.    perform the name change. The result of the name change attempt will
  2008.    be returned to the client in the Modify DN Response.
  2009.  
  2010.    For example, if the entry named in the "entry" parameter was
  2011.    "cn=John Smith,c=US", the newrdn parameter was "cn=John Cougar Smith",
  2012.    and the newSuperior parameter was absent, then this operation would
  2013.  
  2014.  
  2015.  
  2016.  
  2017. Wahl, et. al.               Standards Track                    [Page 36]
  2018.  
  2019. RFC 2251                         LDAPv3                    December 1997
  2020.  
  2021.  
  2022.    attempt to rename the entry to be "cn=John Cougar Smith,c=US".  If
  2023.    there was already an entry with that name, the operation would fail
  2024.    with error code entryAlreadyExists.
  2025.  
  2026.    If the deleteoldrdn parameter is TRUE, the values forming the old
  2027.    RDN are deleted from the entry.  If the deleteoldrdn parameter is
  2028.    FALSE, the values forming the old RDN will be retained as
  2029.    non-distinguished attribute values of the entry.  The server may
  2030.    not perform the operation and return an error code if the setting of
  2031.    the deleteoldrdn parameter would cause a schema inconsistency in the
  2032.    entry.
  2033.  
  2034.    Note that X.500 restricts the ModifyDN operation to only affect
  2035.    entries that are contained within a single server.  If the LDAP
  2036.    server is mapped onto DAP, then this restriction will apply, and the
  2037.    resultCode affectsMultipleDSAs will be returned if this error
  2038.    occurred.  In general clients MUST NOT expect to be able to perform
  2039.    arbitrary movements of entries and subtrees between servers.
  2040.  
  2041. 4.10. Compare Operation
  2042.  
  2043.    The Compare Operation allows a client to compare an assertion
  2044.    provided with an entry in the directory. The Compare Request is
  2045.    defined as follows:
  2046.  
  2047.         CompareRequest ::= [APPLICATION 14] SEQUENCE {
  2048.                 entry           LDAPDN,
  2049.                 ava             AttributeValueAssertion }
  2050.  
  2051.    Parameters of the Compare Request are:
  2052.  
  2053.    - entry: the name of the entry to be compared with.
  2054.  
  2055.    - ava: the assertion with which an attribute in the entry is to be
  2056.      compared.
  2057.  
  2058.    The result of the compare attempted by the server upon receipt of a
  2059.    Compare Request is returned in the Compare Response, defined as
  2060.    follows:
  2061.  
  2062.         CompareResponse ::= [APPLICATION 15] LDAPResult
  2063.  
  2064.    Upon receipt of a Compare Request, a server will attempt to perform
  2065.    the requested comparison. The result of the comparison will be
  2066.    returned to the client in the Compare Response. Note that errors and
  2067.    the result of comparison are all returned in the same construct.
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073. Wahl, et. al.               Standards Track                    [Page 37]
  2074.  
  2075. RFC 2251                         LDAPv3                    December 1997
  2076.  
  2077.  
  2078.    Note that some directory systems may establish access controls which
  2079.    permit the values of certain attributes (such as userPassword) to be
  2080.    compared but not read.  In a search result, it may be that an
  2081.    attribute of that type would be returned, but with an empty set of
  2082.    values.
  2083.  
  2084. 4.11. Abandon Operation
  2085.  
  2086.    The function of the Abandon Operation is to allow a client to request
  2087.    that the server abandon an outstanding operation.  The Abandon
  2088.    Request is defined as follows:
  2089.  
  2090.         AbandonRequest ::= [APPLICATION 16] MessageID
  2091.  
  2092.    The MessageID MUST be that of a an operation which was requested
  2093.    earlier in this connection.
  2094.  
  2095.    (The abandon request itself has its own message id.  This is distinct
  2096.     from the id of the earlier operation being abandoned.)
  2097.  
  2098.    There is no response defined in the Abandon Operation. Upon
  2099.    transmission of an Abandon Operation, a client may expect that the
  2100.    operation identified by the Message ID in the Abandon Request has
  2101.    been abandoned. In the event that a server receives an Abandon
  2102.    Request on a Search Operation in the midst of transmitting responses
  2103.    to the search, that server MUST cease transmitting entry responses to
  2104.    the abandoned request immediately, and MUST NOT send the
  2105.    SearchResponseDone.  Of course, the server MUST ensure that only
  2106.    properly encoded LDAPMessage PDUs are transmitted.
  2107.  
  2108.    Clients MUST NOT send abandon requests for the same operation
  2109.    multiple times, and MUST also be prepared to receive results from
  2110.    operations it has abandoned (since these may have been in transit
  2111.    when the abandon was requested).
  2112.  
  2113.    Servers MUST discard abandon requests for message IDs they do not
  2114.    recognize, for operations which cannot be abandoned, and for
  2115.    operations which have already been abandoned.
  2116.  
  2117. 4.12. Extended Operation
  2118.  
  2119.    An extension mechanism has been added in this version of LDAP, in
  2120.    order to allow additional operations to be defined for services not
  2121.    available elsewhere in this protocol, for instance digitally signed
  2122.    operations and results.
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129. Wahl, et. al.               Standards Track                    [Page 38]
  2130.  
  2131. RFC 2251                         LDAPv3                    December 1997
  2132.  
  2133.  
  2134.    The extended operation allows clients to make requests and receive
  2135.    responses with predefined syntaxes and semantics.  These may be
  2136.    defined in RFCs or be private to particular implementations.  Each
  2137.    request MUST have a unique OBJECT IDENTIFIER assigned to it.
  2138.  
  2139.         ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
  2140.                 requestName      [0] LDAPOID,
  2141.                 requestValue     [1] OCTET STRING OPTIONAL }
  2142.  
  2143.    The requestName is a dotted-decimal representation of the OBJECT
  2144.    IDENTIFIER corresponding to the request. The requestValue is
  2145.    information in a form defined by that request, encapsulated inside an
  2146.    OCTET STRING.
  2147.  
  2148.    The server will respond to this with an LDAPMessage containing the
  2149.    ExtendedResponse.
  2150.  
  2151.         ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
  2152.                 COMPONENTS OF LDAPResult,
  2153.                 responseName     [10] LDAPOID OPTIONAL,
  2154.                 response         [11] OCTET STRING OPTIONAL }
  2155.  
  2156.    If the server does not recognize the request name, it MUST return
  2157.    only the response fields from LDAPResult, containing the
  2158.    protocolError result code.
  2159.  
  2160. 5.  Protocol Element Encodings and Transfer
  2161.  
  2162.    One underlying service is defined here.  Clients and servers SHOULD
  2163.    implement the mapping of LDAP over TCP described in 5.2.1.
  2164.  
  2165. 5.1. Mapping Onto BER-based Transport Services
  2166.  
  2167.    The protocol elements of LDAP are encoded for exchange using the
  2168.    Basic Encoding Rules (BER) [11] of ASN.1 [3]. However, due to the
  2169.    high overhead involved in using certain elements of the BER, the
  2170.    following additional restrictions are placed on BER-encodings of LDAP
  2171.    protocol elements:
  2172.  
  2173.    (1) Only the definite form of length encoding will be used.
  2174.  
  2175.    (2) OCTET STRING values will be encoded in the primitive form only.
  2176.  
  2177.    (3) If the value of a BOOLEAN type is true, the encoding MUST have
  2178.        its contents octets set to hex "FF".
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185. Wahl, et. al.               Standards Track                    [Page 39]
  2186.  
  2187. RFC 2251                         LDAPv3                    December 1997
  2188.  
  2189.  
  2190.    (4) If a value of a type is its default value, it MUST be absent.
  2191.        Only some BOOLEAN and INTEGER types have default values in this
  2192.        protocol definition.
  2193.  
  2194.    These restrictions do not apply to ASN.1 types encapsulated inside of
  2195.    OCTET STRING values, such as attribute values, unless otherwise
  2196.    noted.
  2197.  
  2198. 5.2. Transfer Protocols
  2199.  
  2200.    This protocol is designed to run over connection-oriented, reliable
  2201.    transports, with all 8 bits in an octet being significant in the data
  2202.    stream.
  2203.  
  2204. 5.2.1. Transmission Control Protocol (TCP)
  2205.  
  2206.    The LDAPMessage PDUs are mapped directly onto the TCP bytestream.  It
  2207.    is recommended that server implementations running over the TCP MAY
  2208.    provide a protocol listener on the assigned port, 389.  Servers may
  2209.    instead provide a listener on a different port number. Clients MUST
  2210.    support contacting servers on any valid TCP port.
  2211.  
  2212. 6.  Implementation Guidelines
  2213.  
  2214.    This document describes an Internet protocol.
  2215.  
  2216. 6.1. Server Implementations
  2217.  
  2218.    The server MUST be capable of recognizing all the mandatory attribute
  2219.    type names and implement the syntaxes specified in [5].  Servers MAY
  2220.    also recognize additional attribute type names.
  2221.  
  2222. 6.2. Client Implementations
  2223.  
  2224.    Clients which request referrals MUST ensure that they do not loop
  2225.    between servers. They MUST NOT repeatedly contact the same server for
  2226.    the same request with the same target entry name, scope and filter.
  2227.    Some clients may be using a counter that is incremented each time
  2228.    referral handling occurs for an operation, and these kinds of clients
  2229.    MUST be able to handle a DIT with at least ten layers of naming
  2230.    contexts between the root and a leaf entry.
  2231.  
  2232.    In the absence of prior agreements with servers, clients SHOULD NOT
  2233.    assume that servers support any particular schemas beyond those
  2234.    referenced in section 6.1. Different schemas can have different
  2235.    attribute types with the same names.  The client can retrieve the
  2236.    subschema entries referenced by the subschemaSubentry attribute in
  2237.    the server's root DSE or in entries held by the server.
  2238.  
  2239.  
  2240.  
  2241. Wahl, et. al.               Standards Track                    [Page 40]
  2242.  
  2243. RFC 2251                         LDAPv3                    December 1997
  2244.  
  2245.  
  2246. 7.  Security Considerations
  2247.  
  2248.    When used with a connection-oriented transport, this version of the
  2249.    protocol provides facilities for the LDAP v2 authentication
  2250.    mechanism, simple authentication using a cleartext password, as well
  2251.    as any SASL mechanism [12].  SASL allows for integrity and privacy
  2252.    services to be negotiated.
  2253.  
  2254.    It is also permitted that the server can return its credentials to
  2255.    the client, if it chooses to do so.
  2256.  
  2257.    Use of cleartext password is strongly discouraged where the
  2258.    underlying transport service cannot guarantee confidentiality and may
  2259.    result in disclosure of the password to unauthorized parties.
  2260.  
  2261.    When used with SASL, it should be noted that the name field of the
  2262.    BindRequest is not protected against modification.  Thus if the
  2263.    distinguished name of the client (an LDAPDN) is agreed through the
  2264.    negotiation of the credentials, it takes precedence over any value in
  2265.    the unprotected name field.
  2266.  
  2267.    Implementations which cache attributes and entries obtained via LDAP
  2268.    MUST ensure that access controls are maintained if that information
  2269.    is to be provided to multiple clients, since servers may have access
  2270.    control policies which prevent the return of entries or attributes in
  2271.    search results except to particular authenticated clients.  For
  2272.    example, caches could serve result information only to the client
  2273.    whose request caused it to be cache.
  2274.  
  2275. 8.  Acknowledgements
  2276.  
  2277.    This document is an update to RFC 1777, by Wengyik Yeong, Tim Howes,
  2278.    and Steve Kille.  Design ideas included in this document are based on
  2279.    those discussed in ASID and other IETF Working Groups.  The
  2280.    contributions of individuals in these working groups is gratefully
  2281.    acknowledged.
  2282.  
  2283. 9.  Bibliography
  2284.  
  2285.    [1] ITU-T Rec. X.500, "The Directory: Overview of Concepts, Models
  2286.        and Service",  1993.
  2287.  
  2288.    [2] Yeong, W., Howes, T., and S. Kille, "Lightweight Directory Access
  2289.        Protocol", RFC 1777, March 1995.
  2290.  
  2291.    [3] ITU-T Rec. X.680, "Abstract Syntax Notation One (ASN.1) -
  2292.        Specification of Basic Notation", 1994.
  2293.  
  2294.  
  2295.  
  2296.  
  2297. Wahl, et. al.               Standards Track                    [Page 41]
  2298.  
  2299. RFC 2251                         LDAPv3                    December 1997
  2300.  
  2301.  
  2302.    [4] Kille, S., Wahl, M., and T. Howes, "Lightweight Directory Access
  2303.        Protocol (v3): UTF-8 String Representation of Distinguished
  2304.        Names", RFC 2253, December 1997.
  2305.  
  2306.    [5] Wahl, M., Coulbeck, A., Howes, T., and S. Kille, "Lightweight
  2307.        Directory Access Protocol (v3): Attribute Syntax Definitions",
  2308.        RFC 2252, December 1997.
  2309.  
  2310.    [6] ITU-T Rec. X.501, "The Directory: Models", 1993.
  2311.  
  2312.    [7] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform
  2313.        Resource  Locators (URL)", RFC 1738, December 1994.
  2314.  
  2315.    [8] ITU-T Rec. X.511, "The Directory: Abstract Service Definition",
  2316.        1993.
  2317.  
  2318.    [9] Howes, T., and M. Smith, "The LDAP URL Format", RFC 2255,
  2319.        December 1997.
  2320.  
  2321.    [10] Bradner, S., "Key words for use in RFCs to Indicate Requirement
  2322.         Levels", RFC 2119, March 1997.
  2323.  
  2324.    [11] ITU-T Rec. X.690, "Specification of ASN.1 encoding rules: Basic,
  2325.         Canonical, and Distinguished Encoding Rules", 1994.
  2326.  
  2327.    [12] Meyers, J., "Simple Authentication and Security Layer",
  2328.         RFC 2222, October 1997.
  2329.  
  2330.    [13] Universal Multiple-Octet Coded Character Set (UCS) -
  2331.         Architecture and Basic Multilingual Plane, ISO/IEC 10646-1 :
  2332.         1993.
  2333.  
  2334.    [14] Yergeau, F., "UTF-8, a transformation format of Unicode and ISO
  2335.         10646", RFC 2044, October 1996.
  2336.  
  2337. 10. Authors' Addresses
  2338.  
  2339.    Mark Wahl
  2340.    Critical Angle Inc.
  2341.    4815 W Braker Lane #502-385
  2342.    Austin, TX 78759
  2343.    USA
  2344.  
  2345.    Phone:  +1 512 372-3160
  2346.    EMail:  M.Wahl@critical-angle.com
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353. Wahl, et. al.               Standards Track                    [Page 42]
  2354.  
  2355. RFC 2251                         LDAPv3                    December 1997
  2356.  
  2357.  
  2358.    Tim Howes
  2359.    Netscape Communications Corp.
  2360.    501 E. Middlefield Rd., MS MV068
  2361.    Mountain View, CA 94043
  2362.    USA
  2363.  
  2364.    Phone:  +1 650 937-3419
  2365.    EMail:   howes@netscape.com
  2366.  
  2367.    Steve Kille
  2368.    Isode Limited
  2369.    The Dome, The Square
  2370.    Richmond
  2371.    TW9 1DT
  2372.    UK
  2373.  
  2374.    Phone:  +44-181-332-9091
  2375.    EMail:  S.Kille@isode.com
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409. Wahl, et. al.               Standards Track                    [Page 43]
  2410.  
  2411. RFC 2251                         LDAPv3                    December 1997
  2412.  
  2413.  
  2414. Appendix A - Complete ASN.1 Definition
  2415.  
  2416.         Lightweight-Directory-Access-Protocol-V3 DEFINITIONS
  2417.         IMPLICIT TAGS ::=
  2418.  
  2419.         BEGIN
  2420.  
  2421.         LDAPMessage ::= SEQUENCE {
  2422.                 messageID       MessageID,
  2423.                 protocolOp      CHOICE {
  2424.                         bindRequest     BindRequest,
  2425.                         bindResponse    BindResponse,
  2426.                         unbindRequest   UnbindRequest,
  2427.                         searchRequest   SearchRequest,
  2428.                         searchResEntry  SearchResultEntry,
  2429.                         searchResDone   SearchResultDone,
  2430.                         searchResRef    SearchResultReference,
  2431.                         modifyRequest   ModifyRequest,
  2432.                         modifyResponse  ModifyResponse,
  2433.                         addRequest      AddRequest,
  2434.                         addResponse     AddResponse,
  2435.                         delRequest      DelRequest,
  2436.                         delResponse     DelResponse,
  2437.                         modDNRequest    ModifyDNRequest,
  2438.                         modDNResponse   ModifyDNResponse,
  2439.                         compareRequest  CompareRequest,
  2440.                         compareResponse CompareResponse,
  2441.                         abandonRequest  AbandonRequest,
  2442.                         extendedReq     ExtendedRequest,
  2443.                         extendedResp    ExtendedResponse },
  2444.                  controls       [0] Controls OPTIONAL }
  2445.  
  2446.         MessageID ::= INTEGER (0 .. maxInt)
  2447.  
  2448.         maxInt INTEGER ::= 2147483647 -- (2^^31 - 1) --
  2449.  
  2450.         LDAPString ::= OCTET STRING
  2451.  
  2452.         LDAPOID ::= OCTET STRING
  2453.  
  2454.         LDAPDN ::= LDAPString
  2455.  
  2456.         RelativeLDAPDN ::= LDAPString
  2457.  
  2458.         AttributeType ::= LDAPString
  2459.  
  2460.         AttributeDescription ::= LDAPString
  2461.  
  2462.  
  2463.  
  2464.  
  2465. Wahl, et. al.               Standards Track                    [Page 44]
  2466.  
  2467. RFC 2251                         LDAPv3                    December 1997
  2468.  
  2469.  
  2470.         AttributeDescriptionList ::= SEQUENCE OF
  2471.                 AttributeDescription
  2472.  
  2473.         AttributeValue ::= OCTET STRING
  2474.  
  2475.         AttributeValueAssertion ::= SEQUENCE {
  2476.                 attributeDesc   AttributeDescription,
  2477.                 assertionValue  AssertionValue }
  2478.  
  2479.         AssertionValue ::= OCTET STRING
  2480.  
  2481.         Attribute ::= SEQUENCE {
  2482.                 type    AttributeDescription,
  2483.                 vals    SET OF AttributeValue }
  2484.  
  2485.         MatchingRuleId ::= LDAPString
  2486.  
  2487.         LDAPResult ::= SEQUENCE {
  2488.                 resultCode      ENUMERATED {
  2489.                              success                      (0),
  2490.                              operationsError              (1),
  2491.                              protocolError                (2),
  2492.                              timeLimitExceeded            (3),
  2493.                              sizeLimitExceeded            (4),
  2494.                              compareFalse                 (5),
  2495.                              compareTrue                  (6),
  2496.                              authMethodNotSupported       (7),
  2497.                              strongAuthRequired           (8),
  2498.                                         -- 9 reserved --
  2499.                              referral                     (10),  -- new
  2500.                              adminLimitExceeded           (11),  -- new
  2501.                              unavailableCriticalExtension (12),  -- new
  2502.                              confidentialityRequired      (13),  -- new
  2503.                              saslBindInProgress           (14),  -- new
  2504.                              noSuchAttribute              (16),
  2505.                              undefinedAttributeType       (17),
  2506.                              inappropriateMatching        (18),
  2507.                              constraintViolation          (19),
  2508.                              attributeOrValueExists       (20),
  2509.                              invalidAttributeSyntax       (21),
  2510.                                         -- 22-31 unused --
  2511.                              noSuchObject                 (32),
  2512.                              aliasProblem                 (33),
  2513.                              invalidDNSyntax              (34),
  2514.                              -- 35 reserved for undefined isLeaf --
  2515.                              aliasDereferencingProblem    (36),
  2516.                                         -- 37-47 unused --
  2517.                              inappropriateAuthentication  (48),
  2518.  
  2519.  
  2520.  
  2521. Wahl, et. al.               Standards Track                    [Page 45]
  2522.  
  2523. RFC 2251                         LDAPv3                    December 1997
  2524.  
  2525.  
  2526.                              invalidCredentials           (49),
  2527.                              insufficientAccessRights     (50),
  2528.                              busy                         (51),
  2529.                              unavailable                  (52),
  2530.                              unwillingToPerform           (53),
  2531.                              loopDetect                   (54),
  2532.                                         -- 55-63 unused --
  2533.                              namingViolation              (64),
  2534.                              objectClassViolation         (65),
  2535.                              notAllowedOnNonLeaf          (66),
  2536.                              notAllowedOnRDN              (67),
  2537.                              entryAlreadyExists           (68),
  2538.                              objectClassModsProhibited    (69),
  2539.                                         -- 70 reserved for CLDAP --
  2540.                              affectsMultipleDSAs          (71), -- new
  2541.                                         -- 72-79 unused --
  2542.                              other                        (80) },
  2543.                              -- 81-90 reserved for APIs --
  2544.                 matchedDN       LDAPDN,
  2545.                 errorMessage    LDAPString,
  2546.                 referral        [3] Referral OPTIONAL }
  2547.  
  2548.         Referral ::= SEQUENCE OF LDAPURL
  2549.  
  2550.         LDAPURL ::= LDAPString -- limited to characters permitted in URLs
  2551.  
  2552.         Controls ::= SEQUENCE OF Control
  2553.  
  2554.         Control ::= SEQUENCE {
  2555.                 controlType             LDAPOID,
  2556.                 criticality             BOOLEAN DEFAULT FALSE,
  2557.                 controlValue            OCTET STRING OPTIONAL }
  2558.  
  2559.         BindRequest ::= [APPLICATION 0] SEQUENCE {
  2560.                 version                 INTEGER (1 .. 127),
  2561.                 name                    LDAPDN,
  2562.                 authentication          AuthenticationChoice }
  2563.  
  2564.         AuthenticationChoice ::= CHOICE {
  2565.                 simple                  [0] OCTET STRING,
  2566.                                          -- 1 and 2 reserved
  2567.                 sasl                    [3] SaslCredentials }
  2568.  
  2569.         SaslCredentials ::= SEQUENCE {
  2570.                 mechanism               LDAPString,
  2571.                 credentials             OCTET STRING OPTIONAL }
  2572.  
  2573.         BindResponse ::= [APPLICATION 1] SEQUENCE {
  2574.  
  2575.  
  2576.  
  2577. Wahl, et. al.               Standards Track                    [Page 46]
  2578.  
  2579. RFC 2251                         LDAPv3                    December 1997
  2580.  
  2581.  
  2582.              COMPONENTS OF LDAPResult,
  2583.              serverSaslCreds    [7] OCTET STRING OPTIONAL }
  2584.  
  2585.         UnbindRequest ::= [APPLICATION 2] NULL
  2586.  
  2587.         SearchRequest ::= [APPLICATION 3] SEQUENCE {
  2588.                 baseObject      LDAPDN,
  2589.                 scope           ENUMERATED {
  2590.                         baseObject              (0),
  2591.                         singleLevel             (1),
  2592.                         wholeSubtree            (2) },
  2593.                 derefAliases    ENUMERATED {
  2594.                         neverDerefAliases       (0),
  2595.                         derefInSearching        (1),
  2596.                         derefFindingBaseObj     (2),
  2597.                         derefAlways             (3) },
  2598.                 sizeLimit       INTEGER (0 .. maxInt),
  2599.                 timeLimit       INTEGER (0 .. maxInt),
  2600.                 typesOnly       BOOLEAN,
  2601.                 filter          Filter,
  2602.                 attributes      AttributeDescriptionList }
  2603.  
  2604.         Filter ::= CHOICE {
  2605.                 and             [0] SET OF Filter,
  2606.                 or              [1] SET OF Filter,
  2607.                 not             [2] Filter,
  2608.                 equalityMatch   [3] AttributeValueAssertion,
  2609.                 substrings      [4] SubstringFilter,
  2610.                 greaterOrEqual  [5] AttributeValueAssertion,
  2611.                 lessOrEqual     [6] AttributeValueAssertion,
  2612.                 present         [7] AttributeDescription,
  2613.                 approxMatch     [8] AttributeValueAssertion,
  2614.                 extensibleMatch [9] MatchingRuleAssertion }
  2615.  
  2616.         SubstringFilter ::= SEQUENCE {
  2617.                 type            AttributeDescription,
  2618.                 -- at least one must be present
  2619.                 substrings      SEQUENCE OF CHOICE {
  2620.                         initial [0] LDAPString,
  2621.                         any     [1] LDAPString,
  2622.                         final   [2] LDAPString } }
  2623.  
  2624.         MatchingRuleAssertion ::= SEQUENCE {
  2625.                 matchingRule    [1] MatchingRuleId OPTIONAL,
  2626.                 type            [2] AttributeDescription OPTIONAL,
  2627.                 matchValue      [3] AssertionValue,
  2628.                 dnAttributes    [4] BOOLEAN DEFAULT FALSE }
  2629.  
  2630.  
  2631.  
  2632.  
  2633. Wahl, et. al.               Standards Track                    [Page 47]
  2634.  
  2635. RFC 2251                         LDAPv3                    December 1997
  2636.  
  2637.  
  2638.         SearchResultEntry ::= [APPLICATION 4] SEQUENCE {
  2639.                 objectName      LDAPDN,
  2640.                 attributes      PartialAttributeList }
  2641.  
  2642.         PartialAttributeList ::= SEQUENCE OF SEQUENCE {
  2643.                 type    AttributeDescription,
  2644.                 vals    SET OF AttributeValue }
  2645.  
  2646.         SearchResultReference ::= [APPLICATION 19] SEQUENCE OF LDAPURL
  2647.  
  2648.         SearchResultDone ::= [APPLICATION 5] LDAPResult
  2649.  
  2650.         ModifyRequest ::= [APPLICATION 6] SEQUENCE {
  2651.                 object          LDAPDN,
  2652.                 modification    SEQUENCE OF SEQUENCE {
  2653.                         operation       ENUMERATED {
  2654.                                                 add     (0),
  2655.                                                 delete  (1),
  2656.                                                 replace (2) },
  2657.                         modification    AttributeTypeAndValues } }
  2658.  
  2659.         AttributeTypeAndValues ::= SEQUENCE {
  2660.                 type    AttributeDescription,
  2661.                 vals    SET OF AttributeValue }
  2662.  
  2663.         ModifyResponse ::= [APPLICATION 7] LDAPResult
  2664.  
  2665.         AddRequest ::= [APPLICATION 8] SEQUENCE {
  2666.                 entry           LDAPDN,
  2667.                 attributes      AttributeList }
  2668.  
  2669.         AttributeList ::= SEQUENCE OF SEQUENCE {
  2670.                 type    AttributeDescription,
  2671.                 vals    SET OF AttributeValue }
  2672.  
  2673.         AddResponse ::= [APPLICATION 9] LDAPResult
  2674.  
  2675.         DelRequest ::= [APPLICATION 10] LDAPDN
  2676.  
  2677.         DelResponse ::= [APPLICATION 11] LDAPResult
  2678.  
  2679.         ModifyDNRequest ::= [APPLICATION 12] SEQUENCE {
  2680.                 entry           LDAPDN,
  2681.                 newrdn          RelativeLDAPDN,
  2682.                 deleteoldrdn    BOOLEAN,
  2683.                 newSuperior     [0] LDAPDN OPTIONAL }
  2684.  
  2685.         ModifyDNResponse ::= [APPLICATION 13] LDAPResult
  2686.  
  2687.  
  2688.  
  2689. Wahl, et. al.               Standards Track                    [Page 48]
  2690.  
  2691. RFC 2251                         LDAPv3                    December 1997
  2692.  
  2693.  
  2694.         CompareRequest ::= [APPLICATION 14] SEQUENCE {
  2695.                 entry           LDAPDN,
  2696.                 ava             AttributeValueAssertion }
  2697.  
  2698.         CompareResponse ::= [APPLICATION 15] LDAPResult
  2699.  
  2700.         AbandonRequest ::= [APPLICATION 16] MessageID
  2701.  
  2702.         ExtendedRequest ::= [APPLICATION 23] SEQUENCE {
  2703.                 requestName      [0] LDAPOID,
  2704.                 requestValue     [1] OCTET STRING OPTIONAL }
  2705.  
  2706.         ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
  2707.                 COMPONENTS OF LDAPResult,
  2708.                 responseName     [10] LDAPOID OPTIONAL,
  2709.                 response         [11] OCTET STRING OPTIONAL }
  2710.  
  2711.         END
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.  
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.  
  2726.  
  2727.  
  2728.  
  2729.  
  2730.  
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745. Wahl, et. al.               Standards Track                    [Page 49]
  2746.  
  2747. RFC 2251                         LDAPv3                    December 1997
  2748.  
  2749.  
  2750. Full Copyright Statement
  2751.  
  2752.    Copyright (C) The Internet Society (1997).  All Rights Reserved.
  2753.  
  2754.    This document and translations of it may be copied and furnished to
  2755.    others, and derivative works that comment on or otherwise explain it
  2756.    or assist in its implementation may be prepared, copied, published
  2757.    and distributed, in whole or in part, without restriction of any
  2758.    kind, provided that the above copyright notice and this paragraph are
  2759.    included on all such copies and derivative works.  However, this
  2760.    document itself may not be modified in any way, such as by removing
  2761.    the copyright notice or references to the Internet Society or other
  2762.    Internet organizations, except as needed for the purpose of
  2763.    developing Internet standards in which case the procedures for
  2764.    copyrights defined in the Internet Standards process must be
  2765.    followed, or as required to translate it into languages other than
  2766.    English.
  2767.  
  2768.    The limited permissions granted above are perpetual and will not be
  2769.    revoked by the Internet Society or its successors or assigns.
  2770.  
  2771.    This document and the information contained herein is provided on an
  2772.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  2773.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  2774.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  2775.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  2776.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  2777.  
  2778.  
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801. Wahl, et. al.               Standards Track                    [Page 50]
  2802.  
  2803.