+/* $OpenLDAP$ */
/*
* Copyright (c) 1990 Regents of the University of Michigan.
* All rights reserved.
#include <ac/ctype.h>
#include <ac/socket.h>
+#include <ac/string.h> /* get SAFEMEMCPY */
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include <quipu/modify.h>
#include <quipu/dap2.h>
#include <quipu/dua.h>
+extern IFP merge_acl;
#include "lber.h"
#include "ldap.h"
static CommonArgs common = default_common_args;
-extern short ldap_photo_syntax;
-extern short ldap_jpeg_syntax;
-extern short ldap_jpeg_nonfile_syntax;
-extern short ldap_audio_syntax;
-extern short ldap_dn_syntax;
-extern short ldap_postaladdress_syntax;
-extern short ldap_acl_syntax;
-extern short ldap_mtai_syntax;
-extern short ldap_rts_cred_syntax;
-extern short ldap_rtl_syntax;
-extern short ldap_octetstring_syntax;
-
+static int replace_mod( struct entrymod *, Attr_Sequence, Attr_Sequence );
#ifdef LDAP_COMPAT20
-extern int ldap_compat;
#define MODTAG (ldap_compat == 20 ? OLD_LDAP_RES_MODIFY : LDAP_RES_MODIFY)
#else
#define MODTAG LDAP_RES_MODIFY
char *last;
int rc;
unsigned long tag, len;
- LDAPMod *mods, *modtail;
+ LDAPModList *mods, *modtail;
struct ds_read_arg ra;
- extern DN ldap_str2dn();
Debug( LDAP_DEBUG_TRACE, "do_modify\n", 0, 0, 0 );
mods = modtail = NULL;
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
tag = ber_next_element( ber, &len, last ) ) {
- LDAPMod *tmp;
+ LDAPModList *tmp;
- if ( (tmp = (LDAPMod *) calloc( 1, sizeof(LDAPMod) ))
+ if ( (tmp = (LDAPModList *) calloc( 1, sizeof(LDAPModList) ))
== NULL ) {
send_ldap_msgresult( clientsb, MODTAG, m,
LDAP_OPERATIONS_ERROR, NULL, "Malloc error" );
return( 0 );
}
- if ( ber_scanf( ber, "{i{a[V]}}", &tmp->mod_op, &tmp->mod_type,
- &tmp->mod_bvalues ) == LBER_ERROR ) {
+ if ( ber_scanf( ber, "{i{a[V]}}", &tmp->m.mod_op,
+ &tmp->m.mod_type, &tmp->m.mod_bvalues ) == LBER_ERROR ) {
send_ldap_msgresult( clientsb, MODTAG, m,
LDAP_PROTOCOL_ERROR, NULL, "" );
return( 0 );
struct ds_modifyentry_arg ma;
struct entrymod *changetail = NULLMOD;
int rc;
- LDAPMod *mods;
+ LDAPModList *mods;
Debug( LDAP_DEBUG_TRACE, "do_modify2\n", 0, 0, 0 );
ma.mea_changes = NULLMOD;
for ( mods = m->m_mods; mods != NULL; mods = mods->mod_next ) {
struct entrymod *em;
- Attr_Sequence as, new, get_as();
+ Attr_Sequence as, new;
if ( (em = (struct entrymod *) calloc( 1,
sizeof(struct entrymod) )) == NULLMOD ) {
em->em_next = NULLMOD;
if ( (new = get_as( clientsb, MODTAG, m,
- mods->mod_type, mods->mod_bvalues )) == NULLATTR )
+ mods->m.mod_type, mods->m.mod_bvalues )) == NULLATTR )
return( 0 );
em->em_what = new;
}
if ( new->attr_value == NULLAV &&
- mods->mod_op != LDAP_MOD_DELETE ) {
+ mods->m.mod_op != LDAP_MOD_DELETE ) {
send_ldap_msgresult( clientsb, MODTAG, m,
LDAP_INVALID_SYNTAX, NULL, "No values specified" );
return( 0 );
}
- switch ( mods->mod_op ) {
+ switch ( mods->m.mod_op ) {
case LDAP_MOD_ADD:
Debug( LDAP_DEBUG_ARGS, "ADD:\n", 0, 0, 0 );
AttributeValue av;
int t61str, ncomp;
char *sval, *s, *news, *n;
- extern IFP merge_acl;
- extern AttributeValue bv_asn2AttrV(), ldap_strdn2AttrV();
- extern AttributeValue ldap_str_at2AttrV(), bv_octet2AttrV();
if ( syntax == ldap_jpeg_syntax ||
syntax == ldap_jpeg_nonfile_syntax ||
}
void
-modlist_free( LDAPMod *mods )
+modlist_free( LDAPModList *mods )
{
- LDAPMod *next = NULL;
+ LDAPModList *next;
for ( ; mods != NULL; mods = next ) {
- free( mods->mod_type );
- if ( mods->mod_bvalues != NULL )
- ber_bvecfree( mods->mod_bvalues );
+ free( mods->m.mod_type );
+ if ( mods->m.mod_bvalues != NULL )
+ ber_bvecfree( mods->m.mod_bvalues );
+ next = mods->mod_next;
free( mods );
}
}
* that are not in the new set and by only adding what isn't in old set
*/
-int
+static int
replace_mod(
struct entrymod *rem,
Attr_Sequence oas,