add.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
*
* Portions Copyright %G% Sun Microsystems, Inc.
* All Rights Reserved
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
*
* add.c
*/
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
#include <string.h>
#ifdef MACOS
#include "macos.h"
#endif /* MACOS */
#include <malloc.h>
#include "msdos.h"
#endif /* DOS */
#endif /* !MACOS && !DOS */
#include "lber.h"
#include "ldap.h"
#include "ldap-private.h"
#include "ldap-int.h"
{
BerElement * ber;
int rc, i;
/*
* An add request looks like this:
* AddRequest ::= [APPLICATION 8] SEQUENCE {
* entry DistinguishedName,
* attrs SEQUENCE OF SEQUENCE {
* type AttributeType,
* values SET OF AttributeValue
* }
* }
*/
/* create a message to send */
return( NULLBER );
}
== -1 ) {
return( NULLBER );
}
/* for each attribute in the entry... */
attrs[i]->mod_values );
} else {
attrs[i]->mod_values );
}
if ( rc == -1 ) {
return(NULLBER);
}
}
return( NULLBER );
}
/* LDAPv3 */
/* Code controls if any */
if (serverctrls && serverctrls[0]) {
return( NULLBER );
}
/* Otherwise, is there any global server ctrls ? */
return( NULLBER );
}
}
return( NULLBER );
}
return (ber);
}
/*
* ldap_add - initiate an ldap (and X.500) 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 rv;
#ifdef _REENTRANT
#endif
#ifdef _REENTRANT
#endif
return (-1);
}
/* send the message */
#ifdef _REENTRANT
#endif
return (rv);
}
int
{
int msgid;
}
/* ldapv3 API extensions */
/*
* ldap_add_ext - initiate an ldap (and X.500) add operation. Parameters:
*
* ld LDAP descriptor
* dn DN of the entry to add
* attrs 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.
* serverctrls List of server controls. This is a null-terminated
* array of pointers to LDAPControl structures.
* clientctrls List of client controls.
*
* Example:
* LDAPMod *attrs[] = {
* { 0, "cn", { "babs jensen", "babs", 0 } },
* { 0, "sn", { "jensen", 0 } },
* { 0, "objectClass", { "person", 0 } },
* 0
* }
*
* retcode = ldap_add_ext( ld, dn, attrs, srvctrls, cltctrls, &msgid );
*/
{
int i, rc;
int rv;
#ifdef _REENTRANT
#endif
if (rv == LDAP_SUCCESS)
rv = LDAP_OTHER;
#ifdef _REENTRANT
#endif
return (rv);
}
/* send the message */
if (rv == -1) {
if (rv == LDAP_SUCCESS){
rv = LDAP_OTHER;
}
#ifdef _REENTRANT
#endif
return (rv);
}
#ifdef _REENTRANT
#endif
return (LDAP_SUCCESS);
}
{
int msgid;
int retcode = LDAP_SUCCESS;
return (retcode);
#ifdef _REENTRANT
#endif
if (retcode == LDAP_SUCCESS)
#ifdef _REENTRANT
#endif
return (retcode);
}