LDAP_ADD

Use the LDAP_ADD API to carry out an LDAP operation to add an entry.

  • ldap_add
  • ldap_add_s
  • ldap_add_ext
  • ldap_add_ext_s

Synopsis

#include ldap.h


int ldap_add(
       LDAP           *ld,
       const char     *dn,
       LDAPMod        *attrs[])

int ldap_add_s(
       LDAP           *ld,
       const char     *dn,
       LDAPMod        *attrs[])

int ldap_add_ext( 
       LDAP           *ld,
       const char     *dn,
       LDAPMod        *attrs[],
       LDAPControl    **serverctrls,
       LDAPControl    **clientctrls,
       int            *msgidp)

int ldap_add_ext_s( 
       LDAP           *ld,
       const char     *dn,
       LDAPMod        *attrs[],
       LDAPControl    **serverctrls,
       LDAPControl    **clientctrls)

Input parameters

ld
Specifies the LDAP pointer that is returned by a previous call to ldap_init(), ldap_ssl_init() or ldap_open().
msgid
The message ID of an outstanding LDAP operation, as returned by a call to an asynchronous LDAP operation. For example:
serverctrls
Specifies a list of LDAP server controls. This parameter can be set to NULL. For more information about server controls, see LDAP controls.
clientctrls
Specifies a list of LDAP client controls. This parameter can be set to NULL. For more information about client controls, see LDAP controls.

Usage

The ldap_abandon() and ldap_abandon_ext() APIs are used to abandon or cancel an LDAP operation in progress. The msgid passed must be the message ID of an outstanding LDAP operation, as returned by a call to an asynchronous LDAP operation such as ldap_search(), ldap_modify(), and others.

Both APIs check to see whether the result of the operation is already returned by the server. If the result of the operation is returned, both APIs delete the result of the operation from the queue of pending messages. If not, both APIs send an LDAP abandon operation to the LDAP server.

The result of an abandoned operation is not returned from a future call to ldap_result().

The ldap_abandon() API returns 0 if the abandon was successful or -1 if unsuccessful; it does not support LDAP V3 server controls or client controls. The ldap_abandon_ext() API returns the constant LDAP_SUCCESS if the abandon was successful, or another LDAP error code if not.

Errors

ldap_abandon() returns 0 if the operation is successful, -1 if unsuccessful, setting ld_errno appropriately. For more information, see LDAP_ERROR. ldap_abandon_ext() returns LDAP_SUCCESS if successful and returns an LDAP error code if unsuccessful.

See also

ldap_result, ldap_error