default: {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, ERR,
- "do_modify: invalid modify operation (%ld)\n", (long)mop, 0, 0 );
+ "do_modify: invalid modify operation (%ld)\n",
+ (long)mop, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"do_modify: invalid modify operation (%ld)\n",
goto cleanup;
}
- rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
+ rs->sr_err = dnPrettyNormal( NULL, &dn, &op->o_req_dn, &op->o_req_ndn,
+ op->o_tmpmemctx );
if( rs->sr_err != LDAP_SUCCESS ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_modify: conn %d invalid dn (%s)\n",
* appropriate one, or send a referral to our "referral server"
* if we don't hold it.
*/
- if ( (op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 )) == NULL ) {
+ op->o_bd = select_backend( &op->o_req_ndn, manageDSAit, 0 );
+ if ( op->o_bd == NULL ) {
rs->sr_ref = referral_rewrite( default_referral,
NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
if (!rs->sr_ref) rs->sr_ref = default_referral;
- rs->sr_err = LDAP_REFERRAL;
- send_ldap_result( op, rs );
+ if (rs->sr_ref != NULL ) {
+ rs->sr_err = LDAP_REFERRAL;
+ send_ldap_result( op, rs );
- if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+ if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );
+ } else {
+ send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
+ "referral missing" );
+ }
goto cleanup;
}
slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)modv );
rs->sr_err = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_MODIFY_FN, pb );
- if ( rs->sr_err != 0 ) {
+ if ( rs->sr_err < 0 ) {
/*
* A preoperation plugin failure will abort the
* entire operation.
Debug(LDAP_DEBUG_TRACE, "do_modify: modify preoperation plugin failed.\n",
0, 0, 0);
#endif
- if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0) {
+ if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rs->sr_err ) != 0 ) ||
+ rs->sr_err == LDAP_SUCCESS ) {
rs->sr_err = LDAP_OTHER;
}
slapi_x_free_ldapmods( modv );
if ( op->o_bd->be_modify ) {
/* do the update here */
int repl_user = be_isupdate( op->o_bd, &op->o_ndn );
-#ifndef SLAPD_MULTIMASTER
+
/* Multimaster slapd does not have to check for replicator dn
* because it accepts each modify request
*/
+#if defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
+ if ( !op->o_bd->syncinfo &&
+ ( !op->o_bd->be_update_ndn.bv_len || repl_user ))
+#elif defined(LDAP_SYNCREPL) && defined(SLAPD_MULTIMASTER)
+ if ( !op->o_bd->syncinfo ) /* LDAP_SYNCREPL overrides MM */
+#elif !defined(LDAP_SYNCREPL) && !defined(SLAPD_MULTIMASTER)
if ( !op->o_bd->be_update_ndn.bv_len || repl_user )
#endif
{
replog( op );
}
-#ifndef SLAPD_MULTIMASTER
+#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
/* send a referral */
} else {
- BerVarray defref = op->o_bd->be_update_refs
- ? op->o_bd->be_update_refs : default_referral;
- rs->sr_ref = referral_rewrite( defref,
- NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
-
- if (!rs->sr_ref) rs->sr_ref = defref;
- rs->sr_err = LDAP_REFERRAL;
- send_ldap_result( op, rs );
- if (rs->sr_ref != defref) ber_bvarray_free( rs->sr_ref );
+ BerVarray defref = NULL;
+#ifdef LDAP_SYNCREPL
+ if ( op->o_bd->syncinfo ) {
+ defref = op->o_bd->syncinfo->master_bv;
+ } else
+#endif
+ {
+ defref = op->o_bd->be_update_refs
+ ? op->o_bd->be_update_refs : default_referral;
+ }
+ if ( defref != NULL ) {
+ rs->sr_ref = referral_rewrite( defref,
+ NULL, &op->o_req_dn,
+ LDAP_SCOPE_DEFAULT );
+ if (!rs->sr_ref) rs->sr_ref = defref;
+ rs->sr_err = LDAP_REFERRAL;
+ send_ldap_result( op, rs );
+ if (rs->sr_ref != defref) {
+ ber_bvarray_free( rs->sr_ref );
+ }
+ } else {
+ send_ldap_error( op, rs,
+ LDAP_UNWILLING_TO_PERFORM,
+ "referral missing" );
+ }
#endif
}
} else {
}
#if defined( LDAP_SLAPI )
- if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) != 0 ) {
+ if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_MODIFY_FN, pb ) < 0 ) {
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO, "do_modify: modify postoperation plugins "
"failed\n", 0, 0, 0 );
if( nvals && ad->ad_type->sat_equality &&
ad->ad_type->sat_equality->smr_normalize )
{
- ml->sml_nvalues = ber_memalloc_x( (nvals+1)*sizeof(struct berval), ctx );
+ ml->sml_nvalues = ber_memalloc_x(
+ (nvals+1)*sizeof(struct berval), ctx );
+
for( nvals = 0; ml->sml_values[nvals].bv_val; nvals++ ) {
rc = ad->ad_type->sat_equality->smr_normalize(
0,
return rc;
}
}
+
ml->sml_nvalues[nvals].bv_val = NULL;
ml->sml_nvalues[nvals].bv_len = 0;
+
+ } else {
}
}
}