LDAP\_MODRDN(3) Library Functions Manual LDAP\_MODRDN(3)

# [NAME](#NAME)

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

# [LIBRARY](#LIBRARY)

OpenLDAP LDAP (libldap, -lldap)

# [SYNOPSIS](#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](#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](#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)](/man/enterprise-packages/openldap-2.5/ldap_error.3) for more details.

# [SEE ALSO](#SEE_ALSO)

[**ldap**(3)](/man/enterprise-packages/openldap-2.5/ldap.3), [**ldap\_error**(3)](/man/enterprise-packages/openldap-2.5/ldap_error.3)

# [ACKNOWLEDGEMENTS](#ACKNOWLEDGEMENTS)

**OpenLDAP Software** is developed and maintained by The OpenLDAP Project &lt;http://www.openldap.org/&gt;. **OpenLDAP Software** is derived from the University of Michigan LDAP 3.3 Release.

2025/05/22 OpenLDAP 2.5.20

---

Document: ldap_modrdn2_s(3) from openldap-2.5 2.5.20-r6 (Chainguard OS)
Source: https://git.openldap.org/openldap/openldap.git
