C.3. Examples of LDAP URLs
Note
The following LDAP URL specifies a base search for the entry with the distinguished name dc=example,dc=com.
ldap://ldap.example.com/dc=example,dc=com
- Because no port number is specified, the standard LDAP port number (
389) is used. - Because no attributes are specified, the search returns all attributes.
- Because no search scope is specified, the search is restricted to the base entry
dc=example,dc=com. - Because no filter is specified, the directory uses the default filter (
objectclass=*).
The following LDAP URL retrieves the postalAddress attribute of the entry with the DN dc=example,dc=com:
ldap://ldap.example.com/dc=example,dc=com?postalAddress
- Because no search scope is specified, the search is restricted to the base entry
dc=example,dc=com. - Because no filter is specified, the directory uses the default filter (
objectclass=*).
The following LDAP URL retrieves the cn, mail, and telephoneNumber attributes of the entry for Barbara Jensen:
ldap://ldap.example.com/cn=Barbara%20Jensen,dc=example,dc=com?cn,mail,telephoneNumber
- Because no search scope is specified, the search is restricted to the base entry
cn=Barbara Jensen,dc=example,dc=com. - Because no filter is specified, the directory uses the default filter
(objectclass=*).
The following LDAP URL specifies a search for entries that have the surname Jensen and are at any level under dc=example,dc=com:
ldap://ldap.example.com/dc=example,dc=com??sub?(sn=Jensen)
- Because no attributes are specified, the search returns all attributes.
- Because the search scope is
sub, the search encompasses the base entrydc=example,dc=comand entries at all levels under the base entry.
The following LDAP URL specifies a search for the object class for all entries one level under dc=example,dc=com:
ldap://ldap.example.com/dc=example,dc=com?objectClass?one
- Because the search scope is
one, the search encompasses all entries one level under the base entrydc=example,dc=com. The search scope does not include the base entry. - Because no filter is specified, the directory uses the default filter (
objectclass=*).
Note

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.