LDAP_FIRST_REFERENCE(3)

πŸ’… LDAP_FIRST_REFERENCE(3) πŸ’…

🌸 NAME 🌸

ldap_first_reference, ldap_next_reference, ldap_count_references β€” Stepping through continuation references in a result chain

πŸ“š LIBRARY πŸ“š

OpenLDAP LDAP (libldap, -lldap) β€” yes bestie, that's the one πŸ’–

🧾 SYNOPSIS 🧾

#include <ldap.h>

int ldap_count_references( LDAP *ld, LDAPMessage *result )

LDAPMessage *ldap_first_reference( LDAP *ld, LDAPMessage *result )

LDAPMessage *ldap_next_reference( LDAP *ld, LDAPMessage *reference )

✨ DESCRIPTION ✨

okay so these routines are literally your tour guides through the continuation references in a result chain that you got from ldap_result(3) or the synchronous LDAP search operation routines. Slay πŸ’…

ldap_first_reference() is your main character for grabbing the first reference message in a result chain. You hand it the result that came back from a call to ldap_result(3), ldap_search_s(3), or ldap_search_st(3), and it gives you back a pointer to the first reference message in the result chain. Periodt ✨

Then you take that pointer and pass it into the next call to ldap_next_reference() to get the next reference message. Pass that result into the next call to ldap_next_reference(), and keep going, etc. 🫢 ldap_next_reference() will return NULL when there are no more reference messages. The reference messages returned from these calls are used by ldap_parse_reference(3) to extract referrals and controls. iykyk πŸ”₯

Wanna know how many reference messages are in the search result? Call ldap_count_references() and boom, you got a count. It can also be used to count the number of reference messages remaining in a result chain. No cap πŸ’―

πŸ’€ ERRORS πŸ’€

If an error occurs in ldap_first_reference() or ldap_next_reference(), NULL is returned. If an error occurs in ldap_count_references(), -1 is returned. Not the vibe, but at least you know 😭

πŸ‘€ SEE ALSO πŸ‘€

🫢 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. Iconic behavior honestly πŸ‘‘


OpenLDAP 2.6.16 Β· 2026/10/21 Β· LDAP_FIRST_REFERENCE(3) β€” mwah, love u, bye bestie πŸ’–βœ¨

πŸ“¦ where this page comes from