---
name: "ldap_modrdn"
section: "3"
platform: "linux"
package: "libldap"
version: "2.7.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/ldap_modrdn"
---

# ldap\_modrdn(3)

Perform an LDAP modify RDN operation

## NAME

ldap\_modrdn, ldap\_modrdn\_s, ldap\_modrdn2, ldap\_modrdn2\_s - Perform an LDAP modify RDN operation

## LIBRARY

OpenLDAP LDAP (libldap, -lldap)

## 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;**

## DESCRIPTION

**The** **ldap\_modrdn()** **and** **ldap\_modrdn\_s()** **routines perform an LDAP modify** **RDN operation.  They both take** *dn***, the DN of the entry whose** **RDN is to be changed, and** *newrdn***, the new RDN to give the entry.** **The old RDN of the entry is never kept as an attribute of the entry.** **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.  Use of** **these routines is deprecated.  Use the versions described below** **instead.**

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

## ERRORS

**The synchronous (\_s) versions of these routines return an LDAP error** **code, either LDAP\_SUCCESS or an error if there was trouble.** **The asynchronous versions return -1 in case** **of trouble, setting the** **ld\_errno** **field of** *ld***.  See** [**ldap\_error**(3)](/ldap_error/3.md) **for more details.**

## SEE ALSO

[**ldap**(3)](/ldap/3.md), [**ldap\_error**(3)](/ldap_error/3.md)

## 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.**
