ldap_add_ext_s

Synchronously adds an entry to the directory using LDAP client or server controls.

LDAP Version: v3
Library:*ldapsdk.*
NDS Version:7.xx or higher
Platform:NLM, Windows (NT, 95, 98, 2000, XP, Vista 32-bit and 64-bit ), Linux (32-bit and 64-bit), Solaris, AIX, and HP-UX

Syntax

  #include <ldap.h>
  
  int ldap_add_ext_s (
     LDAP           *ld,
     const char     *dn,
     LDAPMod       **attrs,
     LDAPControl   **serverctrls,
     LDAPControl   **clientctrls);
  
  

Parameters

ld

(IN) Points to the handle for the LDAP session.

dn

(IN) Points to the distinguished name of the entry to add, for example: "o=novell", "ou=provo", "cn=kim"

All components of the dn must exist except for the leaf component. The leaf component name must be unique within the container.

attrs

(IN) Points to a NULL-terminated array of LDAPMod structures that contain the attributes and values to add with the entry. All mandatory attributes must have values or the operation fails.

serverctrls

(IN) Points to an array of LDAPControl structures that list the server controls to use with the add. Use NULL to specify no server controls.

clientctrls

(IN) Points to an array of LDAPControl structures that list the client controls to use with the add. Use NULL to specify no client controls.

msgidp

(OUT) Points to the message ID of the request when the add request succeeds.

Return Values

0x00

LDAP_SUCCESS

Non-zero

Failure. For a complete list, see LDAP Return Codes.

0x01

LDAP_OPERATIONS_ERROR

0x02

LDAP_PROTOCOL_ERROR

0x08

LDAP_STRONG_AUTH_REQUIRED

0x11

LDAP_UNDEFINED_TYPE

0x13

LDAP_CONSTRAINT_VIOLATION

0x14

LDAP_TYPE_OR_VALUE_EXISTS

0x15

LDAP_INVALID_SYNTAX

0x0A

LDAP_REFERRAL

0x0C

LDAP_UNAVAILABLE_CRITICAL_EXTENSION

0x0D

LDAP_CONFIDENTIALITY_REQUIRED

0x20

LDAP_NO_SUCH_OBJECT

0x22

LDAP_INVALID_DN_SYNTAX

0x32

LDAP_INSUFFICIENT_ACCESS

0x33

LDAP_BUSY

0x35

LDAP_UNWILLING_TO_PERFORM

0x36

LDAP_LOOP_DETECT

0x40

LDAP_NAMING_VIOLATION

0x41

LDAP_OBJECT_CLASS_VIOLATION

0x44

LDAP_ALREADY_EXISTS

0x50

LDAP_OTHER

0x53

LDAP_ENCODING_ERROR

0x5A

LDAP_NO_MEMORY

Remarks

For a list of mandatory attributes for an entry see the LDAP server's schema. For eDirectory, see NDK: Novell eDirectory Schema Reference.

If you are adding an entry that logs in to the directory, you need to set a value for the userPassword attribute. The userPassword attribute is not a mandatory attriubute. However, if you create an entry without a userPassword attribute, the entry cannot log in.

eDirectory does not currently support any server-side controls to use with adding entries.

For sample code, see addentry.c and addentry1.c.

See Also

ldap_add, ldap_add_s, ldap_add_ext,