Current File : //usr/man/man3ldap/ldap_add.3ldap
'\" te
.\" Copyright (c) 1990, Regents of the University of Michigan.  All Rights Reserved.
.\" Portions Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
.TH ldap_add 3LDAP "23 Aug 2011" "SunOS 5.11" "LDAP Library Functions"
.SH NAME
ldap_add, ldap_add_s, ldap_add_ext, ldap_add_ext_s \- perform an LDAP add operation
.SH SYNOPSIS
.LP
.nf
cc [ \fIflag\fR... ] \fIfile\fR... -lldap [ \fIlibrary\fR... ]
#include <lber.h>
#include <ldap.h>

\fBint\fR \fBldap_add\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI*attrs\fR[]);
.fi

.LP
.nf
\fBint\fR \fBldap_add_s\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI*attrs\fR[]);
.fi

.LP
.nf
\fBint\fR \fBldap_add_ext\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI**attrs\fR,
     \fBLDAPControl\fR \fI**serverctrls\fR,\ \fBint\fR \fI* msgidp\fR);
.fi

.LP
.nf
\fBint\fR \fBldap_add_ext_s\fR(\fBLDAP\fR \fI*ld\fR, \fBchar\fR \fI*dn\fR, \fBLDAPMod\fR \fI**attrs\fR,
     \fBLDAPControl\fR \fI**serverctrls\fR, \fBLDAPControl\fR \fI**clientctrls\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBldap_add_s()\fR function is used to perform an LDAP add operation. It takes \fIdn\fR, the DN of the entry to add, and \fIattrs\fR, a null-terminated array of the entry's attributes.  The LDAPMod structure is used to represent attributes, with the \fImod_type\fR and \fImod_values\fR fields being used as described under \fBldap_modify\fR(3LDAP), and the \fIldap_op\fR field being used only if you need to specify the  \fBLDAP_MOD_BVALUES\fR option. Otherwise, it should be set to zero.
.sp
.LP
Note that all entries except that specified by the last component in the given DN must already exist. \fBldap_add_s()\fR returns an LDAP error code indicating success or failure of the operation.  See \fBldap_error\fR(3LDAP) for more details.
.sp
.LP
The \fBldap_add()\fR function works just like \fBldap_add_s()\fR, but it is asynchronous.  It returns the message id of the request it initiated.  The result of this operation can be obtained by calling \fBldap_result\fR(3LDAP). 
.sp
.LP
The  \fBldap_add_ext()\fR function initiates an asynchronous add operation and  returns  \fBLDAP_SUCCESS\fR if the request was successfully sent to the server,  or else it returns a LDAP error code if not (see  \fBldap_error\fR(3LDAP)). If successful,  \fBldap_add_ext()\fR \fBplaces\fR \fBthe\fR \fBmessage\fR \fBid\fR \fBof\fR \fI*msgidp\fR. A subsequent call to  \fBldap_result()\fR, can be used to obtain the result of the  add request.
.sp
.LP
The  \fBldap_add_ext_s()\fR function initiates a synchronous add operation and returns the result of the operation itself.
.SH ERRORS
.sp
.LP
\fBldap_add()\fR returns  \fB\(mi1\fR in case of error initiating the request, and will set the \fIld_errno\fR field in the \fIld\fR parameter to indicate the error. \fBldap_add_s()\fR will return an LDAP error code directly.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for a description of the following attributes:
.sp

.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i) 
lw(2.75i) |lw(2.75i) 
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Availabilitysystem/library
_
Interface StabilityCommitted
.TE

.SH SEE ALSO
.sp
.LP
\fBldap\fR(3LDAP), \fBldap_error\fR(3LDAP), \fBldap_modify\fR(3LDAP), \fBattributes\fR(5)