链接:
LDAP基本知识
https://technet.microsoft.com/zh-tw/library/dd159860.aspx
LDAP查询语法
https://www.google.com/support/enterprise/static/postini/docs/admin/en/dss_admin/prep_ldap.html
Syntax
Common LDAP Queries
The directory sync utility uses the LDAP query language to gather information from your directory server. The LDAP query language is a flexible standard that supports complex and powerful logical queries.
To build your LDAP queries, you will need to know your LDAP structure. The best way to collect directory server information is an LDAP browser. For more information, see Useful LDAP Tools.
Google Apps Directory Sync strictly adheres to RFC 2254, which defines international standards on LDAP filters.
Most of the search rules in the directory sync utility use LDAP queries for information. The only exception to this are Exception Rules, which use substring or regular expressions based on the text of email addresses, not LDAP fields.
Note: The support team cannot write LDAP queries for your environment or debug your LDAP queries. While this document lists the most common queries, every directory server is different, and many store information in different fields or formats. To develop these queries, consult standard LDAP documentation and review your LDAP structure with an LDAP browser.
The following syntax is used in LDAP filters:
Name of Operator |
Character |
Use |
Equals |
= |
Creates a filter which requires a field to have a given value. |
Any |
* |
Wildcard to represent that a field can equal anything except NULL. |
Parentheses |
() |
Separates filters to allow other logical operators to function. |
And |
& |
Joins filters together. All conditions in the series must be true. |
Or |
| |
Joins filters together. At least one condition in the series must be true. |
Not |
! |
Excludes all objects that match the filter. |
For examples of how these operators are used, see the common LDAP queries below.
The examples below show the most common LDAP queries. These queries are the most common queries used, and are designed to work with most directory server environments.
objectclass=*.
(&(objectclass=user)(objectcategory=person))
(objectcategory=group)
(objectcategory=publicfolder)
(&(&(objectclass=user)(objectcategory=person))(!(mail=test*)))
(&(&(objectclass=user)(objectcategory=person))(!(mail=*test)))
(&(&(objectclass=user)(objectcategory=person))(!(mail=*test*)))
(|(&(objectclass=user)(objectcategory=person))(objectcategory=group))
(&(|(|(&(objectclass=user)(objectcategory=person))(objectcategory=group))(objectclass=contact))(!(extensionAttribute9=*)))
(&(&(objectclass=user)(objectcategory=person))(!(userAccountControl=514)))
(objectClass=person)
(&(objectclass=user)(objectcategory=person))
(objectClass=inetOrgPerson)
(objectClass=dominoPerson)
(&(|(objectclass=dominoPerson)(objectclass=dominoGroup)(objectclass=dominoServerMailInDatabase))(mail=*))