]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/modify.c
Fix lint in previous commit
[openldap] / servers / slapd / modify.c
index 543594a5d2fb68758a6d07243db1270ae88b5222..3262b5337aa7c7996aacc583d390fe8987452914 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
@@ -75,7 +75,7 @@ do_modify(
         *      }
         */
 
-       if ( ber_scanf( op->o_ber, "{o" /*}*/, &dn ) == LBER_ERROR ) {
+       if ( ber_scanf( op->o_ber, "{m" /*}*/, &dn ) == LBER_ERROR ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
                        "do_modify: ber_scanf failed\n" ));
@@ -106,7 +106,7 @@ do_modify(
                Modifications tmp, *mod;
 
 
-               if ( ber_scanf( op->o_ber, "{i{o[W]}}", &mop,
+               if ( ber_scanf( op->o_ber, "{i{m[W]}}", &mop,
                    &tmp.sml_type, &tmp.sml_bvalues )
                    == LBER_ERROR )
                {
@@ -116,11 +116,8 @@ do_modify(
                        goto cleanup;
                }
 
-               mod = (Modifications *) ch_malloc( sizeof(Modifications) 
-                       + tmp.sml_type.bv_len + 1);
-               mod->sml_type.bv_val = (char *)(mod+1);
-               strcpy(mod->sml_type.bv_val, tmp.sml_type.bv_val);
-               mod->sml_type.bv_len = tmp.sml_type.bv_len;
+               mod = (Modifications *) ch_malloc( sizeof(Modifications) );
+               mod->sml_type = tmp.sml_type;
                mod->sml_bvalues = tmp.sml_bvalues;
                mod->sml_desc = NULL;
                *modtail = mod;
@@ -398,7 +395,6 @@ do_modify(
        }
 
 cleanup:
-       free( dn.bv_val );
        free( pdn.bv_val );
        free( ndn.bv_val );
        if ( modlist != NULL )
@@ -595,6 +591,7 @@ int slap_mods_opattrs(
                if ( tmpval.bv_len ) {
                        mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
                        mod->sml_op = mop;
+                       mod->sml_type.bv_val = NULL;
                        mod->sml_desc = slap_schema.si_ad_structuralObjectClass;
                        mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
                        ber_dupbv( &mod->sml_bvalues[0], &tmpval );
@@ -609,6 +606,7 @@ int slap_mods_opattrs(
                
                mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
                mod->sml_op = mop;
+               mod->sml_type.bv_val = NULL;
                mod->sml_desc = slap_schema.si_ad_entryUUID;
                mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
                ber_dupbv( &mod->sml_bvalues[0], &tmpval );
@@ -619,6 +617,7 @@ int slap_mods_opattrs(
 
                mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
                mod->sml_op = mop;
+               mod->sml_type.bv_val = NULL;
                mod->sml_desc = slap_schema.si_ad_creatorsName;
                mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
                ber_dupbv( &mod->sml_bvalues[0], &name );
@@ -629,6 +628,7 @@ int slap_mods_opattrs(
 
                mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
                mod->sml_op = mop;
+               mod->sml_type.bv_val = NULL;
                mod->sml_desc = slap_schema.si_ad_createTimestamp;
                mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
                ber_dupbv( &mod->sml_bvalues[0], &timestamp );
@@ -640,6 +640,7 @@ int slap_mods_opattrs(
 
        mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
        mod->sml_op = mop;
+       mod->sml_type.bv_val = NULL;
        mod->sml_desc = slap_schema.si_ad_entryCSN;
        mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
        ber_dupbv( &mod->sml_bvalues[0], &csn );
@@ -650,6 +651,7 @@ int slap_mods_opattrs(
 
        mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
        mod->sml_op = mop;
+       mod->sml_type.bv_val = NULL;
        mod->sml_desc = slap_schema.si_ad_modifiersName;
        mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
        ber_dupbv( &mod->sml_bvalues[0], &name );
@@ -660,6 +662,7 @@ int slap_mods_opattrs(
 
        mod = (Modifications *) ch_malloc( sizeof( Modifications ) );
        mod->sml_op = mop;
+       mod->sml_type.bv_val = NULL;
        mod->sml_desc = slap_schema.si_ad_modifyTimestamp;
        mod->sml_bvalues = (BVarray) ch_malloc( 2 * sizeof( struct berval ) );
        ber_dupbv( &mod->sml_bvalues[0], &timestamp );