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
25 int ldap_parse_intermediate( LDAP *ld, LDAPMessage *result,
26 char **retoidp, struct berval **retdatap,
27 LDAPControl ***serverctrlsp, int freeit )
28
30 These routines are used to extract information from a result message.
31 They will operate on the first result message in a chain of search re‐
32 sults (skipping past other message types). They take the result as re‐
33 turned by a call to ldap_result(3), ldap_search_s(3) or
34 ldap_search_st(3). In addition to ldap_parse_result(), the routines
35 ldap_parse_sasl_bind_result() and ldap_parse_extended_result() are used
36 to get all the result information from SASL bind and extended opera‐
37 tions. To extract information from intermediate responses,
38 ldap_parse_intermediate() can be used.
39
40 The errcodep parameter will be filled in with the result code from the
41 result message.
42
43 The server might supply a matched DN string in the message indicating
44 how much of a name in a request was recognized. The matcheddnp parame‐
45 ter will be filled in with this string if supplied, else it will be
46 NULL. If a string is returned, it should be freed using ldap_mem‐
47 free(3).
48
49 The errmsgp parameter will be filled in with the error message field
50 from the parsed message. This string should be freed using ldap_mem‐
51 free(3).
52
53 The referralsp parameter will be filled in with an allocated array of
54 referral strings from the parsed message. This array should be freed
55 using ldap_memvfree(3). If no referrals were returned, *referralsp is
56 set to NULL.
57
58 The serverctrlsp parameter will be filled in with an allocated array of
59 controls copied from the parsed message. The array should be freed us‐
60 ing ldap_controls_free(3). If no controls were returned, *serverctrlsp
61 is set to NULL.
62
63 The freeit parameter determines whether the parsed message is freed or
64 not after the extraction. Any non-zero value will make it free the mes‐
65 sage. The ldap_msgfree(3) routine can also be used to free the message
66 later.
67
68 For SASL bind results, the servercredp parameter will be filled in with
69 an allocated berval structure containing the credentials from the
70 server if present. The structure should be freed using ber_bvfree(3).
71
72 For extended results and intermediate responses, the retoidp parameter
73 will be filled in with the dotted-OID text representation of the name
74 of the extended operation response. The string should be freed using
75 ldap_memfree(3). If no OID was returned, *retoidp is set to NULL.
76
77 For extended results and intermediate responses, the retdatap parameter
78 will be filled in with a pointer to a berval structure containing the
79 data from the extended operation response. The structure should be
80 freed using ber_bvfree(3). If no data were returned, *retdatap is set
81 to NULL.
82
83 For all the above result parameters, NULL values can be used in calls
84 in order to ignore certain fields.
85
87 Upon success LDAP_SUCCESS is returned. Otherwise the values of the re‐
88 sult parameters are undefined.
89
91 ldap(3), ldap_result(3), ldap_search(3), ldap_memfree(3),
92 ldap_memvfree(3), ldap_get_values(3), ldap_controls_free(3), lber-
93 types(3)
94
96 OpenLDAP Software is developed and maintained by The OpenLDAP Project
97 <http://www.openldap.org/>. OpenLDAP Software is derived from the Uni‐
98 versity of Michigan LDAP 3.3 Release.
99
100
101
102OpenLDAP 2.6.3 2022/07/14 LDAP_PARSE_RESULT(3)