LDAP_RENAME(3)

πŸ’… LDAP_RENAME β€” bestie edition πŸŽ€

okay so this is ldap_rename(3) and ldap_rename_s(3) from the OpenLDAP LDAP library, aka libldap, link it with -lldap and you're slaying ✨


✨ NAME ✨

ldap_rename, ldap_rename_s β€” literally renames the entry you point at. iconic behavior, no cap πŸ’–


🌸 LIBRARY 🌸

OpenLDAP LDAP (libldap, -lldap) β€” that's your girl 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <ldap.h>

int ldap_rename( ld, dn, newrdn, newparent, deleteoldrdn, sctrls[], cctrls[], msgidp );
LDAP *ld;
const char *dn, *newrdn, *newparent;
int deleteoldrdn;
LDAPControl *sctrls[], *cctrls[];
int *msgidp);

int ldap_rename_s( ld, dn, newrdn, newparent, deleteoldrdn, sctrls[], cctrls[] );
LDAP *ld;
const char *dn, *newrdn, *newparent;
int deleteoldrdn;
LDAPControl *sctrls[], *cctrls[];

(yes bestie, that stray ) on msgidp is really in there, we don't touch the source, we respect the source πŸ’€)


πŸ”₯ DESCRIPTION πŸ”₯

so these routines do the actual LDAP rename operation, and honestly? it's giving main character energy πŸ‘‘

the function changes the leaf component of an entry's distinguished name, and optionally moves the whole entry over to a new parent container. like moving out of your mom's house but, y'know, in LDAP 🧳

ldap_rename_s performs a rename operation synchronously β€” she waits, she commits, she's dependable πŸ’…

the method takes dn, which points to the distinguished name of the entry whose attribute is being compared. then there's newparent, the distinguished name of the entry's new parent πŸ’–

  • if newparent is NULL, then only the RDN changes β€” nothing gets relocated, we're just doing a little rebrand ✨
  • the root DN is specified by passing a zero length string, "" πŸŽ€

deleteoldrdn specifies whether the old RDN should be retained or deleted:

  • Zero indicates that the old RDN should be retained. if you choose this option, the attribute will contain both names (the old and the new) β€” lowkey hoarding but valid 🫢
  • Non-zero indicates that the old RDN should be deleted. out with the old, periodt πŸ’€

serverctrls points to an array of LDAPControl structures that list the client controls to use with this extended operation. use NULL to specify no client controls 🌈

clientctrls points to an array of LDAPControl structures that list the client controls to use with the search πŸ¦‹

ngl, the sync version is the one you call when you're not trying to do five things at once. but the async one is right there too πŸ‘‡

ldap_rename works just like ldap_rename_s, but the operation is asynchronous β€” she's off doing her own thing, you don't wait around. it returns the message id of the request it initiated, and the result of this operation can be obtained by calling ldap_result(3) ⭐


πŸ’€ ERRORS πŸ’€

  • ldap_rename() returns -1 in case of error initiating the request, and will set the ld_errno field in the ld parameter to indicate the error. not the vibe, but at least she tells you 😭
  • ldap_rename_s() returns the LDAP error code resulting from the rename operation. straightforward, respectful, we stan πŸ™ˆ

🌈 SEE ALSO 🌈

read those too bestie, 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. give them their flowers fr fr πŸ’


OpenLDAP 2.6.16 Β· 2026/10/21 β€” that's the version and date, and that's the whole page, mwah πŸ’‹βœ¨ go rename something and slay πŸ’…

πŸ“¦ where this page comes from