#pragma ident "%Z%%M% %I% %E% SMI"
/*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code, released
* March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*/
/*
* add.c
*/
#if 0
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#endif
#include "ldap-int.h"
/*
* ldap_add - initiate an ldap add operation. Parameters:
*
* ld LDAP descriptor
* dn DN of the entry to add
* mods List of attributes for the entry. This is a null-
* terminated array of pointers to LDAPMod structures.
* only the type and values in the structures need be
* filled in.
*
* Example:
* LDAPMod *attrs[] = {
* { 0, "cn", { "babs jensen", "babs", 0 } },
* { 0, "sn", { "jensen", 0 } },
* { 0, "objectClass", { "person", 0 } },
* 0
* }
* msgid = ldap_add( ld, dn, attrs );
*/
int
{
int msgid;
== LDAP_SUCCESS ) {
return( msgid );
} else {
return( -1 ); /* error is in ld handle */
}
}
/*
* LDAPv3 extended add.
* Returns an LDAP error code.
*/
int
{
/*
* An add request looks like this:
* AddRequest ::= SEQUENCE {
* entry DistinguishedName,
* attrs SEQUENCE OF SEQUENCE {
* type AttributeType,
* values SET OF AttributeValue
* }
* }
*/
if ( !NSLDAPI_VALID_LDAP_POINTER( ld )) {
return( LDAP_PARAM_ERROR );
}
if ( !NSLDAPI_VALID_LDAPMESSAGE_POINTER( msgidp ))
{
return( LDAP_PARAM_ERROR );
}
return( lderr );
}
dn = "";
}
/* see if we should add to the cache */
attrs )) != 0 ) {
return( LDAP_SUCCESS );
}
}
/* create a message to send */
!= LDAP_SUCCESS ) {
return( lderr );
}
== -1 ) {
return( lderr );
}
/* for each attribute in the entry... */
attrs[i]->mod_bvalues );
} else {
attrs[i]->mod_values );
}
if ( rc == -1 ) {
return( lderr );
}
}
return( lderr );
}
!= LDAP_SUCCESS ) {
return( lderr );
}
/* send the message */
}
int
{
}
int LDAP_CALL
{
&msgid )) != LDAP_SUCCESS ) {
return( err );
}
}
}