LDAP_PARSE_RESULT(3)
π ldap_parse_result
okay bestie, grab your iced coffee because this is the ldap_parse_result(3) page from the OpenLDAP library functions manual, and we're about to make result-parsing make sense π«Ά
β¨ NAME β¨
ldap_parse_result β literally the art of parsing results π
π LIBRARY π
OpenLDAP LDAP (libldap, -lldap) β that's the one you link against, no cap.
π¦ SYNOPSIS π¦
#include <ldap.h>
int ldap_parse_result( LDAP *ld, LDAPMessage *result,
int *errcodep, char **matcheddnp, char **errmsgp,
char ***referralsp, LDAPControl ***serverctrlsp,
int freeit )
int ldap_parse_sasl_bind_result( LDAP *ld, LDAPMessage *result,
struct berval **servercredp, int freeit )
int ldap_parse_extended_result( LDAP *ld, LDAPMessage *result,
char **retoidp, struct berval **retdatap, int freeit )
int ldap_parse_intermediate( LDAP *ld, LDAPMessage *result,
char **retoidp, struct berval **retdatap,
LDAPControl ***serverctrlsp, int freeit )
copy these signatures exactly, bestie, they are not vibes-based π
πΈ DESCRIPTION πΈ
So these routines exist to pull information out of a result message β like, they're the little extractor tools π§
They operate on the first result message in a chain of search results (skipping past other message types, iconic behaviour honestly). You feed them a result as returned by a call to ldap_result(3), ldap_search_s(3) or ldap_search_st(3).
Alongside ldap_parse_result(), the routines ldap_parse_sasl_bind_result() and ldap_parse_extended_result() are there to get all the result information from SASL bind and extended operations. And to extract information from intermediate responses, ldap_parse_intermediate() is your girl. π
π the result parameters
errcodepβ gets filled in with the result code from the result message. straight up.matcheddnpβ the server might supply a matched DN string in the message, indicating how much of a name in a request was recognized. If supplied, this param gets filled in with that string; else it'sNULL. If a string comes back, free it withldap_memfree(3)β don't just leave it lying around πerrmsgpβ filled in with the error message field from the parsed message. free this string withldap_memfree(3)too.referralspβ filled in with an allocated array of referral strings from the parsed message. free that array withldap_memvfree(3). If no referrals were returned,*referralspis set toNULL.serverctrlspβ filled in with an allocated array of controls copied from the parsed message. free the array withldap_controls_free(3). If no controls were returned,*serverctrlspis set toNULL.freeitβ decides whether the parsed message gets freed after the extraction or not. Any non-zero value makes it free the message. You can also useldap_msgfree(3)to free it later, if that's more your vibe.
π SASL bind results
For SASL bind results, the servercredp parameter gets filled in with an allocated berval structure containing the credentials from the server, if present. Free that structure using ber_bvfree(3). π
π extended results & intermediate responses
retoidpβ filled in with the dotted-OID text representation of the name of the extended operation response. free the string withldap_memfree(3). If no OID was returned,*retoidpis set toNULL.retdatapβ filled in with a pointer to abervalstructure containing the data from the extended operation response. free that structure withber_bvfree(3). If no data were returned,*retdatapis set toNULL.
β the bestie loophole
For all the above result parameters, you can pass NULL values in calls in order to ignore certain fields. yes really. skip the ones you don't care about, self-care π«Ά
π ERRORS π
Upon success, LDAP_SUCCESS is returned. Otherwise the values of the result parameters are undefined β like, genuinely don't touch them, that's the warning, take it seriously π
π₯ SEE ALSO π₯
ldap(3), ldap_result(3), ldap_search(3), ldap_memfree(3), ldap_memvfree(3), ldap_get_values(3), ldap_controls_free(3), lber-types(3)
go read them, iykyk π
π ACKNOWLEDGEMENTS π
OpenLDAP Software is developed and maintained by The OpenLDAP Project <http://www.openldap.org/>. OpenLDAP Software is derived from the University of Michigan LDAP 3.3 Release.
okay that's the whole page, mwah π this was OpenLDAP 2.6.16, dated 2026/10/21, and it lives at LDAP_PARSE_RESULT(3) β go parse some results, bestie, you're gonna slay β¨ππ¦
π¦ where this page comes from
- fedora 44: openldap-devel 2.6.16-1.fc44 Β· OLDAP-2.8
- fedora 44: openldap-devel 2.6.16-1.fc44 Β· OLDAP-2.8
- Copyright 1998-2026 The OpenLDAP Foundation All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms