+
+#ifdef LDAP_SLAPI
+static void initAddPlugin( Operation *op,
+ struct berval *dn, Entry *e, int manageDSAit )
+{
+ slapi_x_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 doPreAddPluginFNs( Operation *op )
+{
+ int rc;
+
+ rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_PRE_ADD_FN, op->o_pb );
+ if ( rc < 0 ) {
+ /*
+ * A preoperation plugin failure will abort the
+ * entire operation.
+ */
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO, "do_add: add preoperation plugin failed\n",
+ 0, 0, 0);
+#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 )
+ rc = LDAP_OTHER;
+#endif
+ } else {
+ rc = LDAP_SUCCESS;
+ }
+
+ return rc;
+}
+
+static void doPostAddPluginFNs( Operation *op )
+{
+ int rc;
+
+ rc = doPluginFNs( op->o_bd, SLAPI_PLUGIN_POST_ADD_FN, op->o_pb );
+ if ( rc < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO, "do_add: add postoperation plugin failed\n",
+ 0, 0, 0);
+#else
+ Debug(LDAP_DEBUG_TRACE, "do_add: add postoperation plugin failed.\n",
+ 0, 0, 0);
+#endif
+ }
+}
+#endif /* LDAP_SLAPI */