Table of Contents | Previous | Next | Index

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

ldap_rename_s()

Changes the DN of an entry in the directory synchronously.

Syntax

#include <ldap.h>
int ldap_rename_s( LDAP *ld, const char *dn, const char *newrdn,
   const char *newparent, int deleteoldrdn,
   LDAPControl **serverctrls, LDAPControl **clientctrls );

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.

newparent

DN of the new parent entry you want to move the entry under. Pass NULL if you do not want to move the entry to a different location in the directory tree.

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.

serverctrls

Pointer to an array of LDAPControl structures representing LDAP server controls that apply to this LDAP operation. If you do not want to pass any server controls, specify NULL for this argument.

clientctrls

Pointer to an array of LDAPControl structures representing LDAP client controls that apply to this LDAP operation. If you do not want to pass any client controls, specify NULL for this argument.

Returns

One of the following values:

The following result codes can be returned by the Netscape Directory Server when processing an LDAP modify DN request. Other LDAP servers may send these result codes under different circumstances or may send different result codes back to your LDAP client.

Note that the Netscape Directory Server may send other result codes in addition to the codes described here (for example, the server may have loaded a custom plug-in that returns other result codes).

Description

The ldap_rename_s() changes the DN of an entry in the directory synchronously and allows you to move the entry under a different parent entry in the directory tree.

This function is a new version of the ldap_modrdn2_s() function. If you are writing a new LDAP client, you should call this function instead of ldap_modrdn2_s().

You can specify whether or not the old RDN is retained as an attribute of the entry. Use the deleteoldrdn argument to do this. Suppose an entry has the following values for the cn attribute:

   cn: Barbara Jensen
   cn: Babs Jensen
If you change the RDN to cn=Barbie Jensen and pass 1 as deleteoldrdn, the resulting entry has the following values:

   cn: Barbie Jensen
   cn: Babs Jensen
If instead you pass 0 as deleteoldrdn, the "Barbara Jensen" value is not removed from the entry:

   cn: Barbie Jensen
   cn: Babs Jensen
   cn: Barbara Jensen
ldap_rename_s() is a synchronous function, which directly returns the results of the operation. If you want to perform other operations while waiting for the results of this operation, call the asynchronous function ldap_rename() instead. (For more information on asynchronous and synchronous functions, see "Calling Synchronous and Asynchronous Functions" on page 80.)

For more information on changing the DN of an entry, see "Changing the DN of an Entry" on page 217.

Example

See the example under "Example: Renaming an Entry in the Directory (Synchronous)" on page 223.

See Also

ldap_rename().


Table of Contents | Previous | Next | Index

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