home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_a_c / draft-ietf-asid-ldapv3-filter-02.txt < prev    next >
Text File  |  1997-05-06  |  10KB  |  361 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                        Tim Howes
  8. INTERNET DRAFT                           Netscape Communications Corp.
  9. OBSOLETES: RFC 1960                                           May 1997
  10.  
  11.  
  12.             The String Representation of LDAP Search Filters
  13.                  <draft-ietf-asid-ldapv3-filter-02.txt>
  14.  
  15.  
  16.  
  17. 1.  Status of this Memo
  18.  
  19. This document is an Internet-Draft.  Internet-Drafts are  working  docu-
  20. ments  of the Internet Engineering Task Force (IETF), its areas, and its
  21. working groups.  Note that other  groups  may  also  distribute  working
  22. documents as Internet-Drafts.
  23.  
  24. Internet-Drafts are draft documents valid for a maximum  of  six  months
  25. and  may  be  updated,  replaced, or obsoleted by other documents at any
  26. time.  It is inappropriate to use Internet- Drafts as reference material
  27. or to cite them other than as ``work in progress.''
  28.  
  29. To learn the current status of  any  Internet-Draft,  please  check  the
  30. ``1id-abstracts.txt''  listing  contained in the Internet- Drafts Shadow
  31. Directories on ds.internic.net (US East Coast), nic.nordu.net  (Europe),
  32. ftp.isi.edu (US West Coast), or munnari.oz.au (Pacific Rim).
  33.  
  34. 2.  Abstract
  35.  
  36. The Lightweight Directory Access Protocol (LDAP) [1] defines  a  network
  37. representation  of  a search filter transmitted to an LDAP server.  Some
  38. applications may find it useful to have a  common  way  of  representing
  39. these  search filters in a human-readable form.  This document defines a
  40. human-readable string format for representing LDAP search filters.
  41.  
  42. This document replaces RFC 1960, extending the string LDAP filter defin-
  43. ition  to include support for LDAP version 3 extended match filters, and
  44. including support for representing  the  full  range  of  possible  LDAP
  45. search filters.
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. Howes                                                           [Page 1]
  59.  
  60.  
  61.  
  62.  
  63.  
  64. RFC DRAFT                                                       May 1997
  65.  
  66.  
  67. 3.  LDAP Search Filter Definition
  68.  
  69. An LDAPv3 search filter is defined in Section 4.5.1 of [1] as follows:
  70.  
  71.      Filter ::= CHOICE {
  72.              and                [0] SET OF Filter,
  73.              or                 [1] SET OF Filter,
  74.              not                [2] Filter,
  75.              equalityMatch      [3] AttributeValueAssertion,
  76.              substrings         [4] SubstringFilter,
  77.              greaterOrEqual     [5] AttributeValueAssertion,
  78.              lessOrEqual        [6] AttributeValueAssertion,
  79.              present            [7] AttributeDescription,
  80.              approxMatch        [8] AttributeValueAssertion,
  81.              extensibleMatch    [9] MatchingRuleAssertion
  82.      }
  83.  
  84.      SubstringFilter ::= SEQUENCE {
  85.              type    AttributeDescription,
  86.              SEQUENCE OF CHOICE {
  87.                      initial        [0] LDAPString,
  88.                      any            [1] LDAPString,
  89.                      final          [2] LDAPString
  90.              }
  91.      }
  92.  
  93.      AttributeValueAssertion ::= SEQUENCE {
  94.              attributeDesc   AttributeDescription,
  95.              attributeValue  AttributeValue
  96.      }
  97.  
  98.      MatchingRuleAssertion ::= SEQUENCE {
  99.              matchingRule    [1] MatchingRuleID OPTIONAL,
  100.              type            [2] AttributeDescription OPTIONAL,
  101.              matchValue      [3] AssertionValue,
  102.              dnAttributes    [4] BOOLEAN DEFAULT FALSE
  103.      }
  104.  
  105.      AttributeDescription ::= LDAPString
  106.  
  107.      AttributeValue ::= OCTET STRING
  108.  
  109.      MatchingRuleID ::= LDAPString
  110.  
  111.      AssertionValue ::= OCTET STRING
  112.  
  113.      LDAPString ::= OCTET STRING
  114.  
  115.  
  116.  
  117.  
  118. Howes                                                           [Page 2]
  119.  
  120.  
  121.  
  122.  
  123.  
  124. RFC DRAFT                                                       May 1997
  125.  
  126.  
  127. where the LDAPString above is limited to the UTF-8 encoding of  the  ISO
  128. 10646 character set [4].  The AttributeDescription is a string represen-
  129. tation of the attribute description and is defined in [1].  The Attribu-
  130. teValue  and  AssertionValue  OCTET STRING have the form defined in [2].
  131. The Filter is encoded for transmission over a network  using  the  Basic
  132. Encoding Rules defined in [3], with simplifications described in [1].
  133.  
  134. 4.  String Search Filter Definition
  135.  
  136. The string representation of an LDAP search filter  is  defined  by  the
  137. following  grammar,  following  the  ABNF  notation defined in [5].  The
  138. filter format uses a prefix notation.
  139.  
  140.      filter     = "(" filtercomp ")"
  141.      filtercomp = and / or / not / item
  142.      and        = "&" filterlist
  143.      or         = "|" filterlist
  144.      not        = "!" filter
  145.      filterlist = 1*filter
  146.      item       = simple / present / substring / extensible
  147.      simple     = attr filtertype value
  148.      filtertype = equal / approx / greater / less
  149.      equal      = "="
  150.      approx     = "~="
  151.      greater    = ">="
  152.      less       = "<="
  153.      extensible = attr [":dn"] [":" matchingrule] ":=" value
  154.                   / [":dn"] ":" matchingrule ":=" value
  155.      present    = attr "=*"
  156.      substring  = attr "=" [initial] any [final]
  157.      initial    = value
  158.      any        = "*" *(value "*")
  159.      final      = value
  160.      attr       = AttributeDescription from Section 4.1.5 of [1]
  161.      matchingrule = MatchingRuleId from Section 4.1.9 of [1]
  162.      value      = AttributeValue from Section 4.1.6 of [1]
  163.  
  164. The attr, matchingrule, and value constructs are  as  described  in  the
  165. corresponding section of [1] given above.
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178. Howes                                                           [Page 3]
  179.  
  180.  
  181.  
  182.  
  183.  
  184. RFC DRAFT                                                       May 1997
  185.  
  186.  
  187. If a value should contain any of the following characters
  188.  
  189.         Character       ASCII value
  190.         ---------------------------
  191.         *               0x2a
  192.         (               0x28
  193.         )               0x29
  194.         \               0x5c
  195.         NUL             0x00
  196.  
  197. the character must be encoded as  the  backslash  '\'  character  (ASCII
  198. 0x5c)  followed  by  the  two  hexadecimal digits representing the ASCII
  199. value of the encoded character. The case of the two  hexadecimal  digits
  200. is not significant.
  201.  
  202. This simple escaping mechanism eliminates filter-parsing ambiguities and
  203. allows any filter that can be represented in LDAP to be represented as a
  204. NUL-terminated string. Other characters besides the  ones  listed  above
  205. may  be  escaped using this mechanism, for example, non-printing charac-
  206. ters.
  207.  
  208. For example, the filter checking whether the "cn" attribute contained  a
  209. value  with  the  character  "*"  anywhere in it would be represented as
  210. "(cn=*\2a*)".
  211.  
  212. Note that although both the substring and  present  productions  in  the
  213. grammar above can produce the "attr=*" construct, this construct is used
  214. only to denote a presence filter.
  215.  
  216. 5.  Examples
  217.  
  218. This section gives a few examples of search filters written  using  this
  219. notation.
  220.  
  221.      (cn=Babs Jensen)
  222.      (!(cn=Tim Howes))
  223.      (&(objectClass=Person)(|(sn=Jensen)(cn=Babs J*)))
  224.      (o=univ*of*mich*)
  225.  
  226. The following examples illustrate the use of extensible matching.
  227.  
  228.      (cn:1.2.3.4.5:=Fred Flintstone)
  229.      (sn:dn:2.4.6.8.10:=Barney Rubble)
  230.      (o:dn:=Ace Industry)
  231.      (:dn:2.4.6.8.10:=Dino)
  232.  
  233. The second example illustrates the use of the ":dn" notation to indicate
  234. that  matching rule "2.4.6.8.10" should be used when making comparisons,
  235.  
  236.  
  237.  
  238. Howes                                                           [Page 4]
  239.  
  240.  
  241.  
  242.  
  243.  
  244. RFC DRAFT                                                       May 1997
  245.  
  246.  
  247. and that the attributes of an entry's distinguished name should be  con-
  248. sidered part of the entry when evaluating the match.
  249.  
  250. The third example denotes an equality match, except that  DN  components
  251. should be considered part of the entry when doing the match.
  252.  
  253. The fourth example is a filter that should be applied to  any  attribute
  254. supporting  the  matching rule given (since the attr has been left off).
  255. Attributes supporting the matching rule contained in the DN should  also
  256. be considered.
  257.  
  258. The following examples illustrate the use of the escaping mechanism.
  259.  
  260.      (o=Parens R Us \28for all your parenthetical needs\29)
  261.      (cn=*\2A*)
  262.      (filename=C:\5cMyFile)
  263.      (bin=\00\00\00\04)
  264.      (sn=Lu\c4\8di\c4\c7)
  265.  
  266. The first example shows the use of the escaping mechanism  to  represent
  267. parenthesis  characters.  The  second  shows how to represent a "*" in a
  268. value, preventing it from being interpreted as  a  substring  indicator.
  269. The third illustrates the escaping of the backslash character.
  270.  
  271. The fourth example shows a filter  searching  for  the  four-byte  value
  272. 0x00000004,  illustrating the use of the escaping mechanism to represent
  273. arbitrary data, including NUL characters.
  274.  
  275. The final example illustrates the  use  of  the  escaping  mechanism  to
  276. represent various non-ASCII UTF-8 characters.
  277.  
  278. 6.  Security Considerations
  279.  
  280. This memo describes a string  representation  of  LDAP  search  filters.
  281. While the representation itself has no known security implications, LDAP
  282. search filters do. They  are  interpreted  by  LDAP  servers  to  select
  283. entries  from which data is retrieved.  LDAP servers should take care to
  284. protect the data they maintain from unauthorized access.
  285.  
  286. 7.  References
  287.  
  288. [1]  Lightweight Directory Access Protocol (v3), M. Wahl, T.  Howes,  S.
  289.      Kille,   Internet   Draft   draft-ietf-asid-ldapv3-protocol-04.txt,
  290.      March, 1997.
  291.  
  292. [2]  Lightweight Directory Access Protocol (v3): Attribute Syntax Defin-
  293.      itions,  M.  Wahl,  A. Coulbeck, T. Howes, S. Kille, Internet Draft
  294.      draft-ietf-asid-ldapv3-attributes-04.txt, March, 1997.
  295.  
  296.  
  297.  
  298. Howes                                                           [Page 5]
  299.  
  300.  
  301.  
  302.  
  303.  
  304. RFC DRAFT                                                       May 1997
  305.  
  306.  
  307. [3]  Specification of ASN.1 encoding rules: Basic, Canonical,  and  Dis-
  308.      tinguished Encoding Rules, ITU-T Recommendation X.690, 1994.
  309.  
  310. [4]  UTF-8, a transformation format of Unicode and ISO  10646,  F.  Yer-
  311.      geau, draft-yergeau-utf8-rev-00.txt, April, 1997.
  312.  
  313. [5]  Standard for the Format of ARPA Internet Text Messages, D. Crocker,
  314.      RFC 822, August, 1982.
  315.  
  316. 8.  Author's Address
  317.  
  318.    Tim Howes
  319.    Netscape Communications Corp.
  320.    501 E. Middlefield Road
  321.    Mountain View, CA 94043
  322.    USA
  323.    +1 415 937-3419
  324.    howes@netscape.com
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358. Howes                                                           [Page 6]
  359.  
  360.  
  361.