ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/ldap_url_parse.htm

243 lines
6.1 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>ldap_url_parse()--Parse an LDAP URL string</title>
<!-- Begin Header Records -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- Direct1 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- File Edited April 2001 -->
<!-- This file has undergone html cleanup on 2/20/02 by JET -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<a name="Top_Of_Page"></a>
<h2>ldap_url_parse()--Parse an LDAP URL</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;ldap.h&gt;
typedef struct ldap_url_desc {
char *lud_host; /* LDAP host to contact */
int lud_port; /* port on host */
char *lud_dn; /* base for search */
char **lud_attrs; /* NULL-terminate list of attributes */
int lud_scope; /* a valid LDAP_SCOPE_... value */
char *lud_filter; /* LDAP search filter */
char *lud_string; /* for internal use only */
} LDAPURLDesc;
int ldap_url_parse(
char <em>*url</em>,
LDAPURLDesc <em>**ludpp</em>)
</pre>
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Library Name/Service Program: QSYS/QGLDCLNT<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>ldap_url_parse()</strong> function breaks down the LDAP URL
passed in <em>url</em> into its component pieces. The URLs passed in to
<strong>ldap_url_parse()</strong> must be in the local codepage. Use <a href=
"ldap_url_parse_utf8.htm">ldap_url_parse_utf8()</a> for UTF-8 URLs.</p>
<p>The LDAPURLDesc structure returned by this API should be freed with <a href=
"ldap_free_urldesc.htm">ldap_free_urldesc()</a>.</p>
<p>This routine supports the use of LDAP URLs (Uniform Resource Locators).
Supported LDAP URLs look like this, where sections in brackets are
optional:</p>
<pre>
ldap[s]://[<em>hostport</em>][/[<em>dn</em>[?[<em>attributes</em>][?[<em>scope</em>][?[<em>filter</em>]]]]]]
</pre>
<p>where:</p>
<ul>
<li><strong>hostport</strong> is a host name with an optional
":portnumber"</li>
<li><strong>dn</strong> is the base DN to be used for an LDAP search
operation</li>
<li><strong>attributes</strong> is a comma separated list of attributes to be
retrieved</li>
<li><strong>scope</strong> is one of these three strings: base one sub
(default=base)</li>
<li><strong>filter</strong> is LDAP search filter as used in a call to <strong>
ldap_search</strong></li>
</ul>
<p>For example:</p>
<pre>
ldap://example.ibm.com/c=US?o,description?one?o=ibm
</pre>
<p>URLs that are wrapped in angle-brackets and/or preceded by "URL:" are also
tolerated, including the form <em>url:ldapurl</em>.</p>
<p>For example:</p>
<pre>
URL:ldaps://example.ibm.com/c=US?o,description?one?o=ibm
</pre>
<p>This form also is allowed: <em>&lt;url:ldapurl&gt;</em></p>
<p>For example:</p>
<pre>
&lt;URL:ldap://example.ibm.com/c=US?o,description?one?o=ibm&gt;
</pre>
<br>
<h3>Authorities and Locks</h3>
<p>No i5/OS authority is required.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><em>url</em></dt>
<dd>(Input) Specifies a pointer to the URL string.</dd>
<dt><em>ludpp</em></dt>
<dd>(Output) This result parameter will be set to a LDAPURLDesc structure
containing the parsed URL.</dd>
</dl>
<br>
<h3>Return Value</h3>
<dl>
<dt><strong>LDAP_SUCCESS</strong></dt>
<dd>If successful, an LDAP URL description is allocated, filled in, and <em>
ludpp</em> is set to point to it.<br>
<br>
</dd>
<dt><strong>other LDAP Error code</strong></dt>
<dd>If an error occurs, one of these values is returned:</dd>
<dd><br>
<table cellspacing="5">
<!-- cols="30 70" -->
<tr>
<td>LDAP_URL_ERR_NOTLDAP</td>
<td>URL doesn't begin with "ldap://"</td>
</tr>
<tr>
<td>LDAP_URL_ERR_BADSCOPE</td>
<td>URL scope string is invalid</td>
</tr>
<tr>
<td>LDAP_URL_ERR_MEM</td>
<td>can't allocate memory space</td>
</tr>
</table>
</dd>
</dl>
<br>
<h3>Error Messages</h3>
<p>The following message may be sent from this function.</p>
<table width="100%" cellpadding="3">
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPF3CF2 E</td>
<td width="85%" valign="top">Error(s) occurred during running of ldap_url_parse
API.</td>
</tr>
</table>
<br>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="ldap_free_urldesc.htm">ldap_free_urldesc()</a> -- Frees an LDAP
URL description.</li>
<li><a href="ldap_is_ldap_url.htm">ldap_is_ldap_url()</a> -- Check a URL string
to see if it is an LDAP URL.</li>
<li><a href="ldap_url_parse_utf8.htm">ldap_url_parse_utf8()</a> -- Parse a UTF8
codepage LDAP URL string</li>
<li><a href="ldap_url_search.htm">ldap_url_search()</a> -- Asynchronously
search using an LDAP URL.</li>
<li><a href="ldap_url_search_s.htm">ldap_url_search_s()</a> -- Synchronously
search using an LDAP URL.</li>
<li><a href="ldap_url_search_st.htm">ldap_url_search_st()</a> -- Synchronously
search using an LDAP URL and a timeout.</li>
</ul>
<br>
<hr>
API introduced: V4R3
<hr>
<table align="center" cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"dirserv1.htm">LDAP APIs</a> | <a href="aplist.htm">APIs by
category</a></td>
</tr>
</table>
</body>
</html>