1LDAP_URL(3) Library Functions Manual LDAP_URL(3)
2
3
4
6 ldap_is_ldap_url, ldap_url_parse, ldap_free_urldesc - LDAP Uniform Re‐
7 source Locator routines
8
10 OpenLDAP LDAP (libldap, -lldap)
11
13 #include <ldap.h>
14
15 int ldap_is_ldap_url( const char *url )
16
17 int ldap_url_parse( const char *url, LDAPURLDesc **ludpp )
18
19 typedef struct ldap_url_desc {
20 char * lud_scheme; /* URI scheme */
21 char * lud_host; /* LDAP host to contact */
22 int lud_port; /* port on host */
23 char * lud_dn; /* base for search */
24 char ** lud_attrs; /* list of attributes */
25 int lud_scope; /* a LDAP_SCOPE_... value */
26 char * lud_filter; /* LDAP search filter */
27 char ** lud_exts; /* LDAP extensions */
28 int lud_crit_exts; /* true if any extension is critical */
29 /* may contain additional fields for internal use */
30 } LDAPURLDesc;
31
32 void ldap_free_urldesc( LDAPURLDesc *ludp );
33
35 These routines support the use of LDAP URLs (Uniform Resource Locators)
36 as detailed in RFC 4516. LDAP URLs look like this:
37
38 ldap://hostport/dn[?attrs[?scope[?filter[?exts]]]]
39
40 where:
41 hostport is a host name with an optional ":portnumber"
42 dn is the search base
43 attrs is a comma separated list of attributes to request
44 scope is one of these three strings:
45 base one sub (default=base)
46 filter is filter
47 exts are recognized set of LDAP and/or API extensions.
48
49 Example:
50 ldap://ldap.example.net/dc=example,dc=net?cn,sn?sub?(cn=*)
51
52
53 URLs that are wrapped in angle-brackets and/or preceded by "URL:" are
54 also tolerated. Alternative LDAP schemes such as ldaps:// and ldapi://
55 may be parsed using the below routines as well.
56
57 ldap_is_ldap_url() returns a non-zero value if url looks like an LDAP
58 URL (as opposed to some other kind of URL). It can be used as a quick
59 check for an LDAP URL; the ldap_url_parse() routine should be used if a
60 more thorough check is needed.
61
62 ldap_url_parse() breaks down an LDAP URL passed in url into its compo‐
63 nent pieces. If successful, zero is returned, an LDAP URL description
64 is allocated, filled in, and ludpp is set to point to it. If an error
65 occurs, a non-zero URL error code is returned.
66
67 ldap_free_urldesc() should be called to free an LDAP URL description
68 that was obtained from a call to ldap_url_parse().
69
71 ldap(3)
72 RFC 4516 <http://www.rfc-editor.org/rfc/rfc4516.txt>
73
75 OpenLDAP Software is developed and maintained by The OpenLDAP Project
76 <http://www.openldap.org/>. OpenLDAP Software is derived from the Uni‐
77 versity of Michigan LDAP 3.3 Release.
78
79
80
81OpenLDAP 2.6.6 2023/07/31 LDAP_URL(3)