#include "slap.h"
-#ifdef LDAP_SLAPI
-#include "slapi/slapi.h"
-
-static void init_add_pblock( Operation *op, struct berval *dn, Entry *e,
- int manageDSAit );
-static int call_add_preop_plugins( Operation *op );
-static void call_add_postop_plugins( Operation *op );
-#endif /* LDAP_SLAPI */
-
int
do_add( Operation *op, SlapReply *rs )
{
mod = (Modifications *) ch_malloc( sizeof(Modifications) );
mod->sml_op = LDAP_MOD_ADD;
+ mod->sml_flags = 0;
mod->sml_next = NULL;
mod->sml_desc = NULL;
mod->sml_type = tmp.sml_type;
goto done;
}
- rs->sr_err = slap_mods_no_user_mod_check( op, modlist,
+ rs->sr_err = slap_mods_obsolete_check( op, modlist,
&rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
goto done;
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) init_add_pblock( op, &op->o_req_dn, op->ora_e, manageDSAit );
-#endif /* LDAP_SLAPI */
-
/*
* do the add if 1 && (2 || 3)
* 1) there is an add function implemented in this backend;
goto done;
}
-#ifdef LDAP_SLAPI
- /*
- * Call the preoperation plugin here, because the entry
- * will actually contain something.
- */
- if ( op->o_pb ) {
- rs->sr_err = call_add_preop_plugins( op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
- goto done;
- }
- }
-#endif /* LDAP_SLAPI */
-
#ifdef SLAPD_MULTIMASTER
if ( !repl_user )
#endif
#ifndef SLAPD_MULTIMASTER
} else {
BerVarray defref = NULL;
-#ifdef LDAP_SLAPI
- /*
- * SLAPI_ADD_ENTRY will be empty, but this may be acceptable
- * on replicas (for now, it involves the minimum code intrusion).
- */
- if ( op->o_pb ) {
- rs->sr_err = call_add_preop_plugins( op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
- goto done;
- }
- }
-#endif /* LDAP_SLAPI */
defref = op->o_bd->be_update_refs
? op->o_bd->be_update_refs : default_referral;
#endif /* SLAPD_MULTIMASTER */
}
} else {
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) {
- rs->sr_err = call_add_preop_plugins( op );
- if ( rs->sr_err != LDAP_SUCCESS ) {
- /* plugin will have sent result */
- goto done;
- }
- }
-#endif
Debug( LDAP_DEBUG_ARGS, " do_add: no backend support\n", 0, 0, 0 );
send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
"operation not supported within namingContext" );
}
-#ifdef LDAP_SLAPI
- if ( op->o_pb ) call_add_postop_plugins( op );
-#endif /* LDAP_SLAPI */
-
done:;
return rc;
}
mod = (Modifications *) malloc( sizeof( Modifications ));
mod->sml_op = LDAP_MOD_REPLACE;
+ mod->sml_flags = 0;
mod->sml_type = a_new_desc->ad_cname;
return LDAP_SUCCESS;
}
-#ifdef LDAP_SLAPI
-static void init_add_pblock( Operation *op,
- struct berval *dn, Entry *e, int manageDSAit )
-{
- slapi_int_pblock_set_operation( op->o_pb, op );
- slapi_pblock_set( op->o_pb, SLAPI_ADD_TARGET, (void *)dn->bv_val );
- slapi_pblock_set( op->o_pb, SLAPI_ADD_ENTRY, (void *)e );
- slapi_pblock_set( op->o_pb, SLAPI_MANAGEDSAIT, (void *)manageDSAit );
-}
-
-static int call_add_preop_plugins( Operation *op )
-{
- int rc;
-
- rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_PRE_ADD_FN, op->o_pb );
- if ( rc < 0 ) {
- /*
- * A preoperation plugin failure will abort the
- * entire operation.
- */
- 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 ) || rc == LDAP_SUCCESS )
- {
- rc = LDAP_OTHER;
- }
- } else {
- rc = LDAP_SUCCESS;
- }
-
- return rc;
-}
-
-static void call_add_postop_plugins( Operation *op )
-{
- int rc;
-
- rc = slapi_int_call_plugins( op->o_bd, SLAPI_PLUGIN_POST_ADD_FN, op->o_pb );
- if ( rc < 0 ) {
- Debug(LDAP_DEBUG_TRACE,
- "do_add: add postoperation plugin failed\n",
- 0, 0, 0);
- }
-}
-#endif /* LDAP_SLAPI */