1LDAP_PARSE_RESULT(3) Library Functions Manual LDAP_PARSE_RESULT(3)
2
3
4
6 ldap_parse_result - Parsing results
7
9 OpenLDAP LDAP (libldap, -lldap)
10
12 #include <ldap.h>
13
14 int ldap_parse_result( LDAP *ld, LDAPMessage *result,
15 int *errcodep, char **matcheddnp, char **errmsgp,
16 char ***referralsp, LDAPControl ***serverctrlsp,
17 int freeit )
18
19 int ldap_parse_sasl_bind_result( LDAP *ld, LDAPMessage *result,
20 struct berval **servercredp, int freeit )
21
22 int ldap_parse_extended_result( LDAP *ld, LDAPMessage *result,
23 char **retoidp, struct berval **retdatap, int freeit )
24
26 These routines are used to extract information from a result message.
27 They will operate on the first result message in a chain of search
28 results (skipping past other message types). They take the result as
29 returned by a call to ldap_result(3), ldap_search_s(3) or
30 ldap_search_st(3). In addition to ldap_parse_result(), the routines
31 ldap_parse_sasl_bind_result() and ldap_parse_extended_result() are used
32 to get all the result information from SASL bind and extended opera‐
33 tions.
34
35 The errcodep parameter will be filled in with the result code from the
36 result message.
37
38 The server might supply a matched DN string in the message indicating
39 how much of a name in a request was recognized. The matcheddnp parame‐
40 ter will be filled in with this string if supplied, else it will be
41 NULL. If a string is returned, it should be freed using ldap_mem‐
42 free(3).
43
44 The errmsgp parameter will be filled in with the error message field
45 from the parsed message. This string should be freed using ldap_mem‐
46 free(3).
47
48 The referralsp parameter will be filled in with an allocated array of
49 referral strings from the parsed message. This array should be freed
50 using ldap_memvfree(3). If no referrals were returned, *referralsp is
51 set to NULL.
52
53 The serverctrlsp parameter will be filled in with an allocated array of
54 controls copied from the parsed message. The array should be freed
55 using ldap_controls_free(3). If no controls were returned, *serverc‐
56 trlsp is set to NULL.
57
58 The freeit parameter determines whether the parsed message is freed or
59 not after the extraction. Any non-zero value will make it free the mes‐
60 sage. The ldap_msgfree(3) routine can also be used to free the message
61 later.
62
63 For SASL bind results, the servercredp parameter will be filled in with
64 an allocated berval structure containing the credentials from the
65 server if present. The structure should be freed using ber_bvfree(3).
66
67 For extended results, the retoidp parameter will be filled in with the
68 dotted-OID text representation of the name of the extended operation
69 response. The string should be freed using ldap_memfree(3). If no OID
70 was returned, *retoidp is set to NULL.
71
72 For extended results, the retdatap parameter will be filled in with a
73 pointer to a berval structure containing the data from the extended
74 operation response. The structure should be freed using ber_bvfree(3).
75 If no data were returned, *retdatap is set to NULL.
76
77 For all the above result parameters, NULL values can be used in calls
78 in order to ignore certain fields.
79
81 Upon success LDAP_SUCCESS is returned. Otherwise the values of the
82 result parameters are undefined.
83
85 ldap(3), ldap_result(3), ldap_search(3), ldap_memfree(3),
86 ldap_memvfree(3), ldap_get_values(3), ldap_controls_free(3), lber-
87 types(3)
88
90 OpenLDAP Software is developed and maintained by The OpenLDAP Project
91 <http://www.openldap.org/>. OpenLDAP Software is derived from Univer‐
92 sity of Michigan LDAP 3.3 Release.
93
94
95
96OpenLDAP 2.4.44 2016/02/05 LDAP_PARSE_RESULT(3)