]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/modify.c
Fix strchrlen running past end of berval
[openldap] / servers / slapd / modify.c
index 27e746050ad1cf046c714cf533450c3c337b8439..dc2af62473d507d6a2f33ccd6a7a2398b88e98d7 100644 (file)
@@ -171,7 +171,6 @@ do_modify(
 
        if( get_ctrls( op, rs, 1 ) != LDAP_SUCCESS ) {
                Debug( LDAP_DEBUG_ANY, "do_modify: get_ctrls failed\n", 0, 0, 0 );
-
                goto cleanup;
        }
 
@@ -199,6 +198,13 @@ do_modify(
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_modify( op, rs );
 
+#ifdef LDAP_X_TXN
+       if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+               /* skip cleanup */
+               return rs->sr_err;
+       }
+#endif
+
 cleanup:
        op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
        op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
@@ -270,7 +276,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
                                Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
                                    op->o_log_prefix, abuf, 0, 0, 0 );
 
-                               len = 0;
+                               len = 0;
                                ptr = abuf;
 
                                if( 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
@@ -364,13 +370,13 @@ fe_op_modify( Operation *op, SlapReply *rs )
                /* do the update here */
                int repl_user = be_isupdate( op );
 
-               /* Multimaster slapd does not have to check for replicator dn
+               /*
+                * Multimaster slapd does not have to check for replicator dn
                 * because it accepts each modify request
                 */
-               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
-               {
-                       int             update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
-                       slap_callback   cb = { NULL, slap_replog_cb, NULL, NULL };
+               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user ) {
+                       int update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
+                       slap_callback cb = { NULL, slap_replog_cb, NULL, NULL };
 
                        op->o_bd = op_be;
 
@@ -383,8 +389,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
                                }
                        }
 
-                       if ( !repl_user )
-                       {
+                       if ( !repl_user ) {
                                /* but multimaster slapd logs only the ones 
                                 * not from a replicator user */
                                cb.sc_next = op->o_callback;
@@ -392,8 +397,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
                        }
                        op->o_bd->be_modify( op, rs );
 
-               /* send a referral */
-               } else {
+               } else { /* send a referral */
                        BerVarray defref = op->o_bd->be_update_refs
                                ? op->o_bd->be_update_refs : default_referral;
                        if ( defref != NULL ) {
@@ -416,6 +420,7 @@ fe_op_modify( Operation *op, SlapReply *rs )
                                        "shadow context; no update referral" );
                        }
                }
+
        } else {
                send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
                    "operation not supported within namingContext" );
@@ -651,21 +656,11 @@ int slap_mods_check(
                                struct berval pval;
 
                                if ( pretty ) {
-#ifdef SLAP_ORDERED_PRETTYNORM
                                        rc = ordered_value_pretty( ad,
                                                &ml->sml_values[nvals], &pval, ctx );
-#else /* ! SLAP_ORDERED_PRETTYNORM */
-                                       rc = pretty( ad->ad_type->sat_syntax,
-                                               &ml->sml_values[nvals], &pval, ctx );
-#endif /* ! SLAP_ORDERED_PRETTYNORM */
                                } else {
-#ifdef SLAP_ORDERED_PRETTYNORM
                                        rc = ordered_value_validate( ad,
                                                &ml->sml_values[nvals], ml->sml_op );
-#else /* ! SLAP_ORDERED_PRETTYNORM */
-                                       rc = validate( ad->ad_type->sat_syntax,
-                                               &ml->sml_values[nvals] );
-#endif /* ! SLAP_ORDERED_PRETTYNORM */
                                }
 
                                if( rc != 0 ) {
@@ -711,19 +706,11 @@ int slap_mods_check(
                                        (nvals+1)*sizeof(struct berval), ctx );
 
                                for ( nvals = 0; !BER_BVISNULL( &ml->sml_values[nvals] ); nvals++ ) {
-#ifdef SLAP_ORDERED_PRETTYNORM
                                        rc = ordered_value_normalize(
                                                SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
                                                ad,
                                                ad->ad_type->sat_equality,
                                                &ml->sml_values[nvals], &ml->sml_nvalues[nvals], ctx );
-#else /* ! SLAP_ORDERED_PRETTYNORM */
-                                       rc = ad->ad_type->sat_equality->smr_normalize(
-                                               SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
-                                               ad->ad_type->sat_syntax,
-                                               ad->ad_type->sat_equality,
-                                               &ml->sml_values[nvals], &ml->sml_nvalues[nvals], ctx );
-#endif /* ! SLAP_ORDERED_PRETTYNORM */
                                        if ( rc ) {
                                                Debug( LDAP_DEBUG_ANY,
                                                        "<= str2entry NULL (ssyn_normalize %d)\n",