ldap_add(3ldap)


ldap_add, ldap_add_s -- LDAP add operations

Synopsis

#include <lber.h> 
#include <ldap.h> 

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

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

Description

The ldap_add_s routine is used to perform an LDAP add operation. It takes dn, the DN of the entry to add, and attrs, a null-terminated array of the entry's attributes. The LDAPMod structure is used to represent attributes, with the mod_type and mod_values fields being used as described on the ldapmod(4ldap) manual page, and the ldap_op field being used only if you need to specify the LDAP_MOD_BVALUES option. If not, it should be set to zero.

Note that all entries except that specified by the last component in the given DN must already exist. ldap_add_s returns an LDAP error code indicating success or failure of the operation. See ldap_perror(3ldap) for more details.

The ldap_add routine works just like ldap_add_s, but is asynchronous. It returns the message ID of the request it initiated. The result of this operation can be obtained by calling ldap_result(3ldap).

Return values

ldap_add returns a message ID if successful, and -1 in case of error. ldap_add_s returns an LDAP error code directly (LDAP_SUCCESS on success, some error otherwise).

References

Intro(3ldap), ldapmod(4ldap)
30 January 1998
© 1998 The Santa Cruz Operation, Inc. All rights reserved.