Debug( LDAP_DEBUG_ANY, "no values for type %s\n",
tmp.sml_type.bv_val, 0, 0 );
#endif
- send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "no values for attribute type" );
+ send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
+ "no values for attribute type" );
goto done;
}
}
if ( modlist == NULL ) {
- send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "no attributes provided" );
+ send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR,
+ "no attributes provided" );
goto done;
}
if( e->e_nname.bv_len == 0 ) {
/* protocolError may be a more appropriate error */
- send_ldap_error( op, rs, LDAP_ALREADY_EXISTS, "root DSE already exists" );
+ send_ldap_error( op, rs, LDAP_ALREADY_EXISTS,
+ "root DSE already exists" );
goto done;
} else if ( bvmatch( &e->e_nname, &global_schemandn ) ) {
- send_ldap_error( op, rs, LDAP_ALREADY_EXISTS, "subschema subentry already exists" );
+ send_ldap_error( op, rs, LDAP_ALREADY_EXISTS,
+ "subschema subentry already exists" );
goto done;
}
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" );
if ( op->o_bd->be_add ) {
/* do the update here */
int repl_user = be_isupdate(op->o_bd, &op->o_ndn );
-#ifndef SLAPD_MULTIMASTER
+#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
{
size_t textlen = sizeof textbuf;
rs->sr_err = slap_mods_check( modlist, update, &rs->sr_text,
- textbuf, textlen, NULL );
+ textbuf, textlen, NULL );
if( rs->sr_err != LDAP_SUCCESS ) {
send_ldap_result( op, rs );
e = NULL;
}
-#ifndef SLAPD_MULTIMASTER
+#if defined(LDAP_SYNCREPL) || !defined(SLAPD_MULTIMASTER)
} else {
- BerVarray defref;
+ BerVarray defref = NULL;
#ifdef LDAP_SLAPI
/*
* SLAPI_ADD_ENTRY will be empty, but this may be acceptable
}
#endif /* LDAP_SLAPI */
- defref = op->o_bd->be_update_refs
- ? op->o_bd->be_update_refs : default_referral;
+#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, &e->e_name, LDAP_SCOPE_DEFAULT );
#ifdef LDAP_SLAPI
rs->sr_err = doPreAddPluginFNs( op );
if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
- goto done;
- }
+ /* plugin will have sent result */
+ goto done;
+ }
#endif
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, INFO,
Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 );
#endif
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
- "operation not supported within namingContext" );
+ "operation not supported within namingContext" );
}
#ifdef LDAP_SLAPI
/* trim the mods array */
ch_free( mods->sml_nvalues );
mods->sml_nvalues = NULL;
+
} else {
attr->a_nvals = attr->a_vals;
}
int rc = LDAP_SUCCESS;
int match;
- for ( i = 0; mods->sml_nvalues[i].bv_val != NULL; i++ ) {
+ for ( i = 0; mods->sml_values[i].bv_val != NULL; i++ ) {
/* test asserted values against themselves */
for( j = 0; j < i; j++ ) {
rc = value_match( &match, mods->sml_desc, mr,
SLAP_MR_EQUALITY | SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX
| SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH
| SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH,
- &mods->sml_nvalues[i], &mods->sml_nvalues[j], text );
+ mods->sml_nvalues
+ ? &mods->sml_nvalues[i]
+ : &mods->sml_values[i],
+ mods->sml_nvalues
+ ? &mods->sml_nvalues[j]
+ : &mods->sml_values[j],
+ text );
if ( rc == LDAP_SUCCESS && match == 0 ) {
/* value exists already */
snprintf( textbuf, textlen,
#else
Debug(LDAP_DEBUG_TRACE, "do_add: add preoperation plugin failed.\n",
0, 0, 0);
- if ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 )
+ if ( ( slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 ) ||
+ rc == LDAP_SUCCESS ) {
rc = LDAP_OTHER;
+ }
#endif
} else {
rc = LDAP_SUCCESS;