- /* Check for RDN attrs in entry */
- for ( cnt = 0; rdn[ 0 ][ cnt ]; cnt++ ) {
- AttributeDescription *desc = NULL;
- MatchingRule *mr;
- int i;
-
- rc = slap_bv2ad( &rdn[ 0 ][ cnt ]->la_attr,
- &desc, &text );
-
- if ( rc != LDAP_SUCCESS ) {
- send_ldap_result( conn, op, rc,
- NULL, text, NULL, NULL );
- goto done;
- }
-
- for (mod = modlist; mod; mod = mod->sml_next) {
- AttributeDescription *mod_desc = NULL;
-
- rc = slap_bv2ad( &mod->sml_type,
- &mod_desc, &text );
- if ( rc != LDAP_SUCCESS ) {
- send_ldap_result( conn, op, rc,
- NULL, text, NULL, NULL );
- goto done;
- }
-
- if (mod_desc == desc) {
- break;
- }
- }
-
- if (mod == NULL) {
-#define BAILOUT
-#ifdef BAILOUT
- /* bail out */
- send_ldap_result( conn, op,
- rc = LDAP_NO_SUCH_ATTRIBUTE,
- NULL,
- "RDN attribute value assertion not present in entry",
- NULL, NULL );
- goto done;
-
-#else /* ! BAILOUT */
- struct berval bv;
-
- /* add attribute type and value to modlist */
- mod = (Modifications *) ch_malloc( sizeof(Modifications) );
-
- mod->sml_op = LDAP_MOD_ADD;
- mod->sml_next = NULL;
- mod->sml_desc = NULL;
-
- ber_dupbv( &mod->sml_type,
- &rdn[ 0 ][ cnt ]->la_attr );
-
- mod->sml_bvalues = NULL;
- ber_dupbv( &bv, &rdn[ 0 ][ cnt ]->la_value );
- ber_bvarray_add( &mod->sml_bvalues, &bv );
-
- *modtail = mod;
- modtail = &mod->sml_next;
- continue;
-#endif /* ! BAILOUT */
- }
-
- mr = desc->ad_type->sat_equality;
- if (mr == NULL || !mr->smr_match ) {
- /* bail out */
- send_ldap_result( conn, op,
- rc = LDAP_INVALID_SYNTAX,
- NULL,
- "attribute in RDN lacks matching rule",
- NULL, NULL );
- goto done;
- }
-
- for (i = 0; mod->sml_bvalues[ i ].bv_val; i++) {
- int match = 0;
-
- rc = value_match(&match, desc, mr,
- SLAP_MR_VALUE_SYNTAX_MATCH,
- &mod->sml_bvalues[ i ],
- &rdn[ 0 ][ cnt ]->la_value, &text);
-
- if ( rc != LDAP_SUCCESS ) {
- send_ldap_result( conn, op, rc,
- NULL, text, NULL, NULL);
- goto done;
- }
-
- if (match == 0) {
- break;
- }
- }
-
- /* not found? */
- if (mod->sml_bvalues[ i ].bv_val == NULL) {
-#ifdef BAILOUT
- /* bailout */
- send_ldap_result( conn, op,
- rc = LDAP_NO_SUCH_ATTRIBUTE,
- NULL,
- "value in RDN not listed in entry",
- NULL, NULL );
- goto done;
-
-#else /* ! BAILOUT */
- struct berval bv;
-
- /* add attribute type and value to modlist */
- ber_dupbv( &bv, &rdn[ 0 ][ cnt ]->la_value );
- ber_bvarray_add( &mod->sml_bvalues, &bv );
- continue;
-#endif /* ! BAILOUT */
- }
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ send_ldap_result( op, rs );
+ goto done;
+ }
+
+ /* temporary; remove if not invoking backend function */
+ op->ora_modlist = modlist;
+
+ /* call this so global overlays/SLAPI have access to ora_e */
+ rs->sr_err = slap_mods2entry( op->ora_modlist, &op->ora_e,
+ 1, 0, &rs->sr_text, textbuf, textlen );
+ if ( rs->sr_err != LDAP_SUCCESS ) {
+ send_ldap_result( op, rs );
+ goto done;
+ }
+
+ freevals = 0;
+
+ oex.oe.oe_key = (void *)do_add;
+ oex.oe_db = NULL;
+ LDAP_SLIST_INSERT_HEAD(&op->o_extra, &oex.oe, oe_next);
+
+ op->o_bd = frontendDB;
+ rc = frontendDB->be_add( op, rs );
+ LDAP_SLIST_REMOVE(&op->o_extra, &oex.oe, OpExtra, oe_next);
+
+#ifdef LDAP_X_TXN
+ if ( rc == LDAP_X_TXN_SPECIFY_OKAY ) {
+ /* skip cleanup */
+ return rc;
+ } else
+#endif
+ if ( rc == 0 ) {
+ if ( op->ora_e != NULL && oex.oe_db != NULL ) {
+ BackendDB *bd = op->o_bd;
+
+ op->o_bd = oex.oe_db;
+
+ be_entry_release_w( op, op->ora_e );
+
+ op->ora_e = NULL;
+ op->o_bd = bd;