ldap_parse_result()--Extract Information from Results




Syntax

#include <ldap.h>
 
int ldap_parse_result(
       LDAP            *ld,
       LDAPMessage     *res,
       int             *errcodep,
       char            **matcheddnp,
       char            **errmsgp,
       char            ***referralsp,
       LDAPControl     ***servctrlsp,
       int             freeit)



Threadsafe: Yes

The ldap_parse_result() routine is used to:

Authorities and Locks

No OS/400 authority is required. All authority checking is done by the LDAP server.

Parameters

ld
(Input) Specifies the LDAP pointer returned by a previous call to ldap_init(),ldap_ssl_init(), or ldap_open().

res
(Input) Specifies the result of an LDAP operation as returned by ldap_result() or one of the synchronous LDAP API operation calls.

errcodep
(Input) Specifies a pointer to the result parameter that will be filled in with the LDAP error code field from the LDAPMessage message. The LDAPResult message is produced by the LDAP server, and indicates the outcome of the operation. NULL can be specified for errcodep if the LDAPResult message is to be ignored.

matcheddnp
(Input) Specifies a pointer to a result parameter. When LDAP_NO_SUCH_OBJECT is returned as the LDAP error code, this result parameter will be filled in with a Distinguished Name indicating how much of the name in the request was recognized by the server. NULL can be specified for matcheddnp if the matched DN is to be ignored. The matched DN string should be freed by calling ldap_memfree().

errmsgp
(Input) Specifies a pointer to a result parameter that is filled in with the contents of the error message from the LDAPMessage message. The error message string should be freed by calling ldap_memfree().

referralsp
(Input) Specifies a pointer to a result parameter that is filled in with the contents of the referrals field from the LDAPMessage message, indicating zero or more alternate LDAP servers where the request should be retried. The referrals array should be freed by calling ldap_value_free(). NULL may be supplied for this parameter to ignore the referrals field.

serverctrlsp
(Input) Specifies a pointer to a result parameter that is filled in with an allocated array of controls copied out of the LDAPMessage message. The control array should be freed by calling ldap_controls_free().

freeit
(Input) Specifies a boolean value that determines if the LDAP result chain (as specified by ref) is to be freed. Any non-zero value will result in the LDAP result chain being freed after the requested information is extracted. Alternatively, the ldap_msgfree() API can be used to free the LDAP result chain at a later time.

Return Value

LDAP_SUCCESS
if the result was successfully located and parsed.
another LDAP error code
if not successfully parsed.

Error Conditions

If ldap_parse_result() will return LDAP error code if not successful. See LDAP Client API Error Conditions for possible LDAP error code values.

Error Messages

    The following message may be set from this function.
    CPF3CF2 E  Error(s) occurred during running of ldap_parse_result API.

Related Information

    ldap_parse_sasl_bind_result() -- Extract server credentials from SASL bind results.


Top | LDAP APIs List
APIs by category

[Information Center Home Page | Feedback ] [Legal | AS/400 Glossary]