Table of Contents | Previous | Next | Index

Netscape Directory SDK 3.0 for C Programmer’s Guide
     Chapter 18 Functions

ldap_modrdn2_s()

Changes the relative distinguished name (RDN) of an entry in the directory synchronously.

Note that this is an older function that is included in the LDAP API for backward-compatibility. If you are writing a new LDAP client, use ldap_rename_s() instead.

Syntax

#include <ldap.h>
int ldap_modrdn2_s( LDAP *ld, const char *dn,
   const char *newrdn, int deleteoldrdn );

Parameters

This function has the following parameters:

ld

Connection handle, which is a pointer to an LDAP structure containing information about the connection to the LDAP server.

dn

Distinguished name (DN) of the entry to modify.

newrdn

New relative distinguished name (RDN) to assign to the entry.

deleteoldrdn

If this is a non-zero value, the old RDN is not retained as a value in the modified entry. If 0, the old RDN is retained as an attribute in the modified entry.

Returns

For a list of possible result codes, see the result code documentation for the ldap_rename_s() function.

Description

The ldap_modrdn2_s() function modifies the relative distinguished name (RDN) of an entry in a directory and lets you specify whether or not the old RDN is retained as an attribute of the entry.

A newer version of this function, ldap_rename_s(), is available in this release of the LDAP API. ldap_modrdn2_s() (the older version of the function) is included only for backward-compatibility. If you are writing a new LDAP client, use ldap_rename_s() instead of ldap_modrdn2_s().

If you want more information on ldap_modrdn2_s(), refer to the LDAP C SDK 1.0 Programmer's Guide.

Example

The following section of code uses the synchronous ldap_modrdn2_s() function to change the RDN of an entry from "uid=bjensen" to "uid=babs". The code removes the existing RDN "babs" from the uid attribute of the entry.

#include <ldap.h>
...
LDAP *ld;
/* Distinguished name of the entry that you want to rename. */
char *dn = "uid=bjensen, ou=People, o=Airius.com";
/* New relative distinguished name (RDN) of the entry */
char *rdn = "uid=babs";
...
/* Rename the entry */
if ( ldap_modrdn2_s( ld, dn, rdn, 1 ) != LDAP_SUCCESS ) {
   ldap_perror( ld, "ldap_modrdn2_s" );
   return( 1 );
}
...

See Also

ldap_rename_s().


Table of Contents | Previous | Next | Index

Last Updated: 10/01/98 17:06:23