LDAP_MODRDN(3)

πŸ’… LDAP_MODRDN(3) β€” Library Functions Manual, bestie

okay so this page is literally about the modify RDN glow-up for LDAP entries, and yes it lives in the Library Functions Manual section because that's its home ✨


🌸 NAME 🌸

ldap_modrdn, ldap_modrdn_s, ldap_modrdn2, ldap_modrdn2_s β€” Perform an LDAP modify RDN operation

like, that's the whole vibe: you're renaming an entry's RDN and these four functions are the ones who do it πŸŽ€


πŸ¦‹ LIBRARY πŸ¦‹

OpenLDAP LDAP (libldap, -lldap)

that's the library, that's the link flag, no notes πŸ‘‘


✨ SYNOPSIS ✨

#include <ldap.h>

int ldap_modrdn(ld, dn, newrdn)
LDAP βˆ—ld;
char βˆ—dn, βˆ—newrdn;

int ldap_modrdn_s(ld, dn, newrdn)
LDAP βˆ—ld;
char βˆ—dn, βˆ—newrdn;

int ldap_modrdn2(ld, dn, newrdn, deleteoldrdn)
LDAP βˆ—ld;
char βˆ—dn, βˆ—newrdn;
int deleteoldrdn;

int ldap_modrdn2_s(ld, dn, newrdn, deleteoldrdn)
LDAP βˆ—ld;
char βˆ—dn, βˆ—newrdn;
int deleteoldrdn;

four functions, one #include <ldap.h>, all spelled exactly like that β€” do not come for the βˆ— characters, they're iconic and they're staying 🫢


πŸ’– DESCRIPTION πŸ’–

okay so ldap_modrdn() and ldap_modrdn_s() perform an LDAP modify RDN operation. both of them take dn, which is the DN of the entry whose RDN is to be changed, and newrdn, which is the new RDN to give the entry. very demure, very straightforward πŸ’…

the old RDN of the entry is never kept as an attribute of the entry β€” like, she's gone, no leftovers, no emotional baggage 🧚

ldap_modrdn() is asynchronous, returning the message id of the operation it initiates. ldap_modrdn_s() is synchronous, returning the LDAP error code indicating the success or failure of the operation.

🫢 heads up bestie: use of these routines is deprecated. use the versions described below instead. i'm not mad, i'm just disappointed 😭

The ldap_modrdn2() and ldap_modrdn2_s() routines also perform an LDAP modify RDN operation, taking the same parameters as above. In addition, they both take the deleteoldrdn parameter, which is used as a boolean value to indicate whether the old RDN values should be deleted from the entry or not. so like β€” you finally get a say in whether the old name sticks around as an attribute 🌈


πŸ’€ ERRORS πŸ’€

The synchronous (_s) versions of these routines return an LDAP error code, either LDAP_SUCCESS or an error if there was trouble. slay when it's LDAP_SUCCESS, big sigh when it's not 😭

The asynchronous versions return -1 in case of trouble, setting the ld_errno field of ld. so check that field, bestie, it's literally telling you what went wrong πŸ”₯

See ldap_error(3) for more details β€” that's the one who spills all the tea about error codes ✨


πŸŽ€ SEE ALSO πŸŽ€

go read those next, they're giving required reading energy πŸ‘‘


🌟 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.

give them their flowers, fr fr πŸŒΈπŸ’


and that's the page, bestie β€” signed off with OpenLDAP 2.6.16, dated 2026/10/21, filed forever under LDAP_MODRDN(3) πŸ’œβœ¨

πŸ“¦ where this page comes from