LDAP_COMPARE(3)
π LDAP_COMPARE(3) β the compare glow-up
okay so this is LDAP_COMPARE(3) from the Library Functions Manual, and bestie, it's literally all about performing an LDAP compare operation. Four functions, one job: does this entry have this value or not. iykyk.
π NAME
ldap_compare, ldap_compare_s, ldap_compare_ext, ldap_compare_ext_s β perform an LDAP compare operation. that's it, that's the whole vibe.
π LIBRARY
OpenLDAP LDAP (libldap, -lldap) β yeah, you gotta link the lib, no cap.
β¨ SYNOPSIS
#include <ldap.h>
int ldap_compare_ext(
LDAP *ld,
char *dn,
char *attr,
const struct berval *bvalue,
LDAPControl **serverctrls,
LDAPControl **clientctrls,
int *msgidp );
int ldap_compare_ext_s(
LDAP *ld,
char *dn,
char *attr,
const struct berval *bvalue,
LDAPControl **serverctrls,
LDAPControl **clientctrls );
like, copy these exactly, please. const struct berval *bvalue is not a suggestion π
π¦ DESCRIPTION
so ldap_compare_ext_s() is the synchronous one β it does the LDAP compare operation and just... waits. icon behavior, honestly. it takes dn, the DN of the entry you're comparing against, plus attr and value, the attribute description and the value you want to compare to whatever's actually sitting in that entry. and then it returns a code:
LDAP_COMPARE_TRUEif the entry contains the attribute value β slay πLDAP_COMPARE_FALSEif it does not β tragic, but valid πΈ- otherwise you get an error code telling you what kind of problem it is. see
ldap(3)for the deets, bestie.
and ldap_compare_ext() is the asynchronous one, main character energy β¨. same parameters as ldap_compare_ext_s(), but it hands you back the message id of the request it just kicked off, in the integer that msgidp points to. wanna know the result of the compare? that's a whole separate call to ldap_result(3) later. patience, queen π
both routines let you specify server and client controls to extend the compare request. fancy π
π DEPRECATED INTERFACES
okay so listen β ldap_compare() and ldap_compare_s() are deprecated in favor of ldap_compare_ext() and ldap_compare_ext_s(), respectively. retired. past their era. we don't stan π
deprecated interfaces generally remain in the library though (they're lurking, not gone). you can define the macro LDAP_DEPRECATED to a non-zero value (e.g., -DLDAP_DEPRECATED=1) when compiling a program designed to use deprecated interfaces β that's how you get them to show up.
and like, genuinely: it is recommended that developers writing new programs, or updating old programs, avoid use of deprecated interfaces. over time it's expected that documentation (and, eventually, support) for deprecated interfaces gets eliminated. so... don't get attached π
π SEE ALSO
go read those, fr fr π«Ά
π 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. giving credit where it's due, as always π
β and that's the tea! this little beauty is from OpenLDAP 2.6.16, dated 2026/10/21 β LDAP_COMPARE(3) out π
β¨
π¦ 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