1 .lf 1 stdin 2 .TH LDAP_URL 3 "2025/05/22" "OpenLDAP 2.6.10" 3 .\" $OpenLDAP$ 4 .\" Copyright 1998-2024 The OpenLDAP Foundation All Rights Reserved. 5 .\" Copying restrictions apply. See COPYRIGHT/LICENSE. 6 .SH NAME 7 ldap_is_ldap_url, ldap_url_parse, ldap_free_urldesc \- LDAP Uniform Resource Locator routines 8 .SH LIBRARY 9 OpenLDAP LDAP (libldap, \-lldap) 10 .SH SYNOPSIS 11 .nf 12 .ft B 13 #include <ldap.h> 14 .LP 15 .ft B 16 int ldap_is_ldap_url( const char *url ) 17 .LP 18 .ft B 19 int ldap_url_parse( const char *url, LDAPURLDesc **ludpp ) 20 .LP 21 typedef struct ldap_url_desc { 22 char * lud_scheme; /* URI scheme */ 23 char * lud_host; /* LDAP host to contact */ 24 int lud_port; /* port on host */ 25 char * lud_dn; /* base for search */ 26 char ** lud_attrs; /* list of attributes */ 27 int lud_scope; /* a LDAP_SCOPE_... value */ 28 char * lud_filter; /* LDAP search filter */ 29 char ** lud_exts; /* LDAP extensions */ 30 int lud_crit_exts; /* true if any extension is critical */ 31 /* may contain additional fields for internal use */ 32 } LDAPURLDesc; 33 .LP 34 .ft B 35 void ldap_free_urldesc( LDAPURLDesc *ludp ); 36 .SH DESCRIPTION 37 These routines support the use of LDAP URLs (Uniform Resource Locators) 38 as detailed in RFC 4516. LDAP URLs look like this: 39 .nf 40 41 \fBldap://\fP\fIhostport\fP\fB/\fP\fIdn\fP[\fB?\fP\fIattrs\fP[\fB?\fP\fIscope\fP[\fB?\fP\fIfilter\fP[\fB?\fP\fIexts\fP]]]] 42 43 where: 44 \fIhostport\fP is a host name with an optional ":portnumber" 45 \fIdn\fP is the search base 46 \fIattrs\fP is a comma separated list of attributes to request 47 \fIscope\fP is one of these three strings: 48 base one sub (default=base) 49 \fIfilter\fP is filter 50 \fIexts\fP are recognized set of LDAP and/or API extensions. 51 52 Example: 53 ldap://ldap.example.net/dc=example,dc=net?cn,sn?sub?(cn=*) 54 55 .fi 56 .LP 57 URLs that are wrapped in angle-brackets and/or preceded by "URL:" are also 58 tolerated. Alternative LDAP schemes such as ldaps:// and ldapi:// may be 59 parsed using the below routines as well. 60 .LP 61 .B ldap_is_ldap_url() 62 returns a non-zero value if \fIurl\fP looks like an LDAP URL (as 63 opposed to some other kind of URL). It can be used as a quick check 64 for an LDAP URL; the 65 .B ldap_url_parse() 66 routine should be used if a more thorough check is needed. 67 .LP 68 .B ldap_url_parse() 69 breaks down an LDAP URL passed in \fIurl\fP into its component pieces. 70 If successful, zero is returned, an LDAP URL description is 71 allocated, filled in, and \fIludpp\fP is set to point to it. If an 72 error occurs, a non-zero URL error code is returned. 73 .LP 74 .B ldap_free_urldesc() 75 should be called to free an LDAP URL description that was obtained from 76 a call to 77 .B ldap_url_parse(). 78 .SH SEE ALSO 79 .nf 80 .BR ldap (3) 81 .BR "RFC 4516" " <http://www.rfc-editor.org/rfc/rfc4516.txt>" 82 .SH ACKNOWLEDGEMENTS 83 .fi 84 .lf 1 ./../Project 85 .\" Shared Project Acknowledgement Text 86 .B "OpenLDAP Software" 87 is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. 88 .B "OpenLDAP Software" 89 is derived from the University of Michigan LDAP 3.3 Release. 90 .lf 84 stdin 91