slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value)
{
#ifdef PBLOCK_ANALYTICS
    pblock_analytics_record(pblock, arg);
#endif
    char *authtype;

    PR_ASSERT(NULL != pblock);

    switch (arg) {
#ifdef PBLOCK_ANALYTICS
    case SLAPI_HINT:
        break;
#endif
    case SLAPI_BACKEND:
        pblock->pb_backend = (Slapi_Backend *)value;
        if (pblock->pb_backend && (NULL == pblock->pb_plugin)) {
            /* newly allocated pblock may not have backend plugin set. */
            pblock->pb_plugin =
                (struct slapdplugin *)pblock->pb_backend->be_database;
        }
        break;
    case SLAPI_BACKEND_COUNT:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_backend_count = *((int *)value);
        break;
    case SLAPI_CONNECTION:
        pblock->pb_conn = (Connection *)value;
        break;
    case SLAPI_OPERATION:
        pblock->pb_op = (Operation *)value;
        break;
    case SLAPI_OPINITIATED_TIME:
        break;
    case SLAPI_REQUESTOR_ISROOT:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_requestor_isroot = *((int *)value);
        break;
    case SLAPI_IS_REPLICATED_OPERATION:
        PR_ASSERT(0);
        break;
    case SLAPI_OPERATION_PARAMETERS:
        PR_ASSERT(0);
        break;
    case SLAPI_CONN_ID:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CONN_ID \n");
            return (-1);
        }
        pblock->pb_conn->c_connid = *((uint64_t *)value);
        break;
    case SLAPI_CONN_DN:
        /*
             * Slightly crazy but we must pass a copy of the current
             * authtype into bind_credentials_set() since it will
             * free the current authtype.
             */
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CONN_DN \n");
            return (-1);
        }
        slapi_pblock_get(pblock, SLAPI_CONN_AUTHMETHOD, &authtype);
        bind_credentials_set(pblock->pb_conn, authtype,
                             (char *)value, NULL, NULL, NULL, NULL);
        slapi_ch_free((void **)&authtype);
        break;
    case SLAPI_CONN_AUTHTYPE: /* deprecated */
    case SLAPI_CONN_AUTHMETHOD:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set",
                          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        slapi_ch_free((void **)&pblock->pb_conn->c_authtype);
        pblock->pb_conn->c_authtype = slapi_ch_strdup((char *)value);
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_CLIENTNETADDR_ACLIP:
        if (pblock->pb_conn == NULL) {
            break;
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        slapi_ch_free((void **)&pblock->pb_conn->cin_addr_aclip);
        pblock->pb_conn->cin_addr_aclip = (PRNetAddr *)value;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_IS_REPLICATION_SESSION:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set",
                          "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        pblock->pb_conn->c_isreplication_session = *((int *)value);
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;

    /* stuff related to config file processing */
    case SLAPI_CONFIG_FILENAME:
    case SLAPI_CONFIG_LINENO:
    case SLAPI_CONFIG_ARGC:
    case SLAPI_CONFIG_ARGV:
        return (-1); /* deprecated since DS 5.0 (no longer useful) */

    /* pblock memory management */
    case SLAPI_DESTROY_CONTENT:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_destroy_content = *((int *)value);
        break;

    /* stuff related to the current plugin */
    case SLAPI_PLUGIN:
        pblock->pb_plugin = (struct slapdplugin *)value;
        break;
    case SLAPI_PLUGIN_PRIVATE:
        pblock->pb_plugin->plg_private = (void *)value;
        break;
    case SLAPI_PLUGIN_TYPE:
        pblock->pb_plugin->plg_type = *((int *)value);
        break;
    case SLAPI_PLUGIN_ARGV:
        pblock->pb_plugin->plg_argv = (char **)value;
        break;
    case SLAPI_PLUGIN_ARGC:
        pblock->pb_plugin->plg_argc = *((int *)value);
        break;
    case SLAPI_PLUGIN_VERSION:
        pblock->pb_plugin->plg_version = (char *)value;
        break;
    case SLAPI_PLUGIN_PRECEDENCE:
        pblock->pb_plugin->plg_precedence = *((int *)value);
        break;
    case SLAPI_PLUGIN_OPRETURN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_opreturn = *((int *)value);
        break;
    case SLAPI_PLUGIN_OBJECT:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_object = (void *)value;
        break;
    case SLAPI_PLUGIN_IDENTITY:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_plugin_identity = (void *)value;
        break;
    case SLAPI_PLUGIN_CONFIG_AREA:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_plugin_config_area = (char *)value;
        break;
    case SLAPI_PLUGIN_DESTROY_FN:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_destroy_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_DESCRIPTION:
        pblock->pb_plugin->plg_desc = *((Slapi_PluginDesc *)value);
        break;
    case SLAPI_PLUGIN_INTOP_RESULT:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_internal_op_result = *((int *)value);
        break;
    case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_plugin_internal_search_op_entries = (Slapi_Entry **)value;
        break;
    case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_plugin_internal_search_op_referrals = (char **)value;
        break;
    case SLAPI_REQUESTOR_DN:
        if (pblock->pb_op == NULL) {
            return (-1);
        }
        slapi_sdn_set_dn_byval((&pblock->pb_op->o_sdn), (char *)value);
        break;
    case SLAPI_REQUESTOR_SDN:
        if (pblock->pb_op == NULL) {
            return (-1);
        }
        slapi_sdn_set_dn_byval((&pblock->pb_op->o_sdn), slapi_sdn_get_dn((Slapi_DN *)value));
        break;
    /* database plugin functions */
    case SLAPI_PLUGIN_DB_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_bind = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_unbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_search = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_next_search_entry = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_next_search_entry_ext = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_search_results_release = (VFPP)value;
        break;
    case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_prev_search_results = (VFP)value;
        break;
    case SLAPI_PLUGIN_DB_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_compare = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_modify = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_modrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_add = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_delete = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_abandon = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_CONFIG_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_config = (IFP)value;
        break;
    case SLAPI_PLUGIN_CLOSE_FN:
        pblock->pb_plugin->plg_close = (IFP)value;
        break;
    case SLAPI_PLUGIN_CLEANUP_FN:
        pblock->pb_plugin->plg_cleanup = (IFP)value;
        break;
    case SLAPI_PLUGIN_START_FN:
        pblock->pb_plugin->plg_start = (IFP)value;
        break;
    case SLAPI_PLUGIN_POSTSTART_FN:
        pblock->pb_plugin->plg_poststart = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:
        pblock->pb_plugin->plg_wire_import = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_GET_INFO_FN:
        pblock->pb_plugin->plg_get_info = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SET_INFO_FN:
        pblock->pb_plugin->plg_set_info = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_CTRL_INFO_FN:
        pblock->pb_plugin->plg_ctrl_info = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SEQ_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_seq = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ENTRY_FN:
        pblock->pb_plugin->plg_entry = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_REFERRAL_FN:
        pblock->pb_plugin->plg_referral = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_RESULT_FN:
        pblock->pb_plugin->plg_result = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_RMDB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_rmdb = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_LDIF2DB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_ldif2db = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DB2LDIF_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_db2ldif = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DB2INDEX_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_db2index = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_archive2db = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_db2archive = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_UPGRADEDB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_upgradedb = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_UPGRADEDNFORMAT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_upgradednformat = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DBVERIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_dbverify = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_BEGIN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_begin = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_COMMIT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_commit = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ABORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_TEST_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbtest = (IFP)value;
        break;
    /* database plugin-specific parameters */
    case SLAPI_PLUGIN_DB_NO_ACL:
        if (pblock->pb_plugin && pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        if (NULL == pblock->pb_backend) {
            return (-1);
        }
        pblock->pb_backend->be_noacl = *((int *)value);
        break;
    case SLAPI_PLUGIN_DB_COMPACT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_dbcompact = (IFP)value;
        break;

    /* extendedop plugin functions */
    case SLAPI_PLUGIN_EXT_OP_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_exhandler = (IFP)value;
        break;
    case SLAPI_PLUGIN_EXT_OP_OIDLIST:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_exoids = (char **)value;
        ldapi_register_extended_op((char **)value);
        break;
    case SLAPI_PLUGIN_EXT_OP_NAMELIST:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_exnames = (char **)value;
        break;
    case SLAPI_PLUGIN_EXT_OP_BACKEND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_be_exhandler = (IFP)value;
        break;

    /* preoperation plugin functions */
    case SLAPI_PLUGIN_PRE_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_prebind = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preunbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_presearch = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_precompare = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_premodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_premodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_predelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preabandon = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preentry = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_REFERRAL_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_prereferral = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_RESULT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preresult = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_EXTOP_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREEXTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preextop = (IFP)value;
        break;

    /* postoperation plugin functions */
    case SLAPI_PLUGIN_POST_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postunbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postsearch = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_SEARCH_FAIL_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postsearchfail = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postcompare = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postmodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postmodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postdelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postabandon = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postentry = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_REFERRAL_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postreferral = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_RESULT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postresult = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_EXTOP_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTEXTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postextop = (IFP)value;
        break;

    /* backend preoperation plugin */
    case SLAPI_PLUGIN_BE_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepremodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepremodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepreadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepredelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_CLOSE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepreclose = (IFP)value;
        break;

    /* backend postoperation plugin */
    case SLAPI_PLUGIN_BE_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostmodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostmodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostdelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_OPEN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostopen = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_EXPORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostexport = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_IMPORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostimport = (IFP)value;
        break;

    /* internal preoperation plugin */
    case SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_modify = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_modrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_add = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_delete = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_bind = (IFP)value;
        break;

    /* internal postoperation plugin */
    case SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_modify = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_modrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_add = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_delete = (IFP)value;
        break;

    /* backend preoperation plugin - called just after creating transaction */
    case SLAPI_PLUGIN_BE_TXN_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpremodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpremodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpreadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpredelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_DELETE_TOMBSTONE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpredeletetombstone = (IFP)value;
        break;

    /* backend postoperation plugin - called just before committing transaction */
    case SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostmodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostmodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostdelete = (IFP)value;
        break;

    /* syntax plugin functions */
    case SLAPI_PLUGIN_SYNTAX_FILTER_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_filter_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_FILTER_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_filter_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_VALUES2KEYS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_values2keys = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_assertion2keys_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_assertion2keys_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_NAMES:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        PR_ASSERT(pblock->pb_plugin->plg_syntax_names == NULL);
        pblock->pb_plugin->plg_syntax_names = slapi_ch_array_dup((char **)value);
        break;
    case SLAPI_PLUGIN_SYNTAX_OID:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        PR_ASSERT(pblock->pb_plugin->plg_syntax_oid == NULL);
        pblock->pb_plugin->plg_syntax_oid = slapi_ch_strdup((char *)value);
        break;
    case SLAPI_PLUGIN_SYNTAX_FLAGS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_flags = *((int *)value);
        break;
    case SLAPI_PLUGIN_SYNTAX_COMPARE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_compare = (IFP)value;
        break;
    case SLAPI_SYNTAX_SUBSTRLENS: /* aka SLAPI_MR_SUBSTRLENS */
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_substrlens = (int *)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_VALIDATE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_validate = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_NORMALIZE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_normalize = (VFPV)value;
        break;
    case SLAPI_ENTRY_PRE_OP:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_pre_op_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ENTRY_POST_OP:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_post_op_entry = (Slapi_Entry *)value;
        break;

    /* target address for all operations */
    case SLAPI_TARGET_ADDRESS:
        PR_ASSERT(PR_FALSE); /* can't do this */
        break;
    case SLAPI_TARGET_DN: /* DEPRECATED */
        /* slapi_pblock_set(pb, SLAPI_TARGET_DN, val) automatically
         * replaces SLAPI_TARGET_SDN.  Caller should not free the
         * original SLAPI_TARGET_SDN, but the reset one here by getting
         * the address using slapi_pblock_get(pb, SLAPI_TARGET_SDN, &sdn). */
        if (pblock->pb_op != NULL) {
            Slapi_DN *sdn = pblock->pb_op->o_params.target_address.sdn;
            slapi_sdn_free(&sdn);
            pblock->pb_op->o_params.target_address.sdn = slapi_sdn_new_dn_byval((char *)value);
        } else {
            return (-1);
        }
        break;
    case SLAPI_TARGET_SDN: /* alias from SLAPI_ADD_TARGET_SDN */
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.target_address.sdn = (Slapi_DN *)value;
        } else {
            return (-1);
        }
        break;
    case SLAPI_ORIGINAL_TARGET_DN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.target_address.udn = (char *)value;
        }
        break;
    case SLAPI_TARGET_UNIQUEID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.target_address.uniqueid = (char *)value;
        }
        break;
    case SLAPI_REQCONTROLS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.request_controls = (LDAPControl **)value;
        }
        break;
    case SLAPI_RESCONTROLS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.result_controls = (LDAPControl **)value;
        }
        break;
    case SLAPI_CONTROLS_ARG: /* used to pass control argument before operation is created */
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_ctrls_arg = (LDAPControl **)value;
        break;
    case SLAPI_ADD_RESCONTROL:
        if (pblock->pb_op != NULL) {
            add_control(&pblock->pb_op->o_results.result_controls, (LDAPControl *)value);
        }
        break;

    /* notes to be added to the access log RESULT line for this op. */
    case SLAPI_OPERATION_NOTES:
        _pblock_assert_pb_intop(pblock);
        if (value == NULL) {
            pblock->pb_intop->pb_operation_notes = 0; /* cleared */
        } else {
            pblock->pb_intop->pb_operation_notes |= *((unsigned int *)value);
        }
        break;
    case SLAPI_SKIP_MODIFIED_ATTRS:
        if (pblock->pb_op == NULL)
            break;
        if (value == 0) {
            pblock->pb_op->o_flags &= ~OP_FLAG_SKIP_MODIFIED_ATTRS;
        } else {
            pblock->pb_op->o_flags |= OP_FLAG_SKIP_MODIFIED_ATTRS;
        }
        break;
    /* controls we know about */
    case SLAPI_MANAGEDSAIT:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_managedsait = *((int *)value);
        break;
    case SLAPI_PWPOLICY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_pwpolicy_ctrl = *((int *)value);
        break;

    /* add arguments */
    case SLAPI_ADD_ENTRY:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_add.target_entry = (Slapi_Entry *)value;
        }
        break;
    case SLAPI_ADD_EXISTING_DN_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_existing_dn_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_existing_uniqueid_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ADD_PARENT_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_parent_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ADD_PARENT_UNIQUEID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_add.parentuniqueid = (char *)value;
        }
        break;

    /* bind arguments */
    case SLAPI_BIND_METHOD:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_bind.bind_method = *((ber_tag_t *)value);
        }
        break;
    case SLAPI_BIND_CREDENTIALS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_bind.bind_creds = (struct berval *)value;
        }
        break;
    case SLAPI_BIND_SASLMECHANISM:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_bind.bind_saslmechanism = (char *)value;
        }
        break;
    /* bind return values */
    case SLAPI_BIND_RET_SASLCREDS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_bind.bind_ret_saslcreds = (struct berval *)value;
        }
        break;

    /* compare arguments */
    case SLAPI_COMPARE_TYPE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_compare.compare_ava.ava_type = (char *)value;
        }
        break;
    case SLAPI_COMPARE_VALUE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_compare.compare_ava.ava_value = *((struct berval *)value);
        }
        break;

    /* modify arguments */
    case SLAPI_MODIFY_MODS:
        PR_ASSERT(pblock->pb_op);
        if (pblock->pb_op != NULL) {
            if (pblock->pb_op->o_params.operation_type == SLAPI_OPERATION_MODIFY) {
                pblock->pb_op->o_params.p.p_modify.modify_mods = (LDAPMod **)value;
            } else if (pblock->pb_op->o_params.operation_type == SLAPI_OPERATION_MODRDN) {
                pblock->pb_op->o_params.p.p_modrdn.modrdn_mods = (LDAPMod **)value;
            } else {
                PR_ASSERT(0);
            }
        }
        break;

    /* modrdn arguments */
    case SLAPI_MODRDN_NEWRDN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_modrdn.modrdn_newrdn = (char *)value;
        }
        break;
    case SLAPI_MODRDN_DELOLDRDN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_modrdn.modrdn_deloldrdn = *((int *)value);
        }
        break;
    case SLAPI_MODRDN_NEWSUPERIOR: /* DEPRECATED */
        if (pblock->pb_op != NULL) {
            Slapi_DN *sdn =
                pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn;
            slapi_sdn_free(&sdn);
            pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn =
                slapi_sdn_new_dn_byval((char *)value);
        } else {
            return -1;
        }
        break;
    case SLAPI_MODRDN_NEWSUPERIOR_SDN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn =
                (Slapi_DN *)value;
        } else {
            return -1;
        }
        break;
    case SLAPI_MODRDN_PARENT_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_parent_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_MODRDN_NEWPARENT_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_newparent_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_MODRDN_TARGET_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_target_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
        PR_ASSERT(PR_FALSE); /* can't do this */
        break;
    /* search arguments */
    case SLAPI_SEARCH_SCOPE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_scope = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_DEREF:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_deref = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_SIZELIMIT:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_sizelimit = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_TIMELIMIT:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_timelimit = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_FILTER:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_filter = (struct slapi_filter *)value;
        }
        break;
    case SLAPI_SEARCH_STRFILTER:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_strfilter = (char *)value;
        }
        break;
    case SLAPI_SEARCH_ATTRS:
        if (pblock->pb_op != NULL) {
#if defined(USE_OLD_UNHASHED)
            char **attrs;
            for (attrs = (char **)value; attrs && *attrs; attrs++) {
                /* Get rid of forbidden attr, e.g.,
                 * PSEUDO_ATTR_UNHASHEDUSERPASSWORD,
                 * which never be returned. */
                if (is_type_forbidden(*attrs)) {
                    char **ptr;
                    for (ptr = attrs; ptr && *ptr; ptr++) {
                        if (ptr == attrs) {
                            slapi_ch_free_string(ptr); /* free unhashed type */
                        }
                        *ptr = *(ptr + 1); /* attrs is NULL terminated;
                                              the NULL is copied here. */
                    }
                }
            }
#endif
            pblock->pb_op->o_params.p.p_search.search_attrs = (char **)value;
        }
        break;
    case SLAPI_SEARCH_GERATTRS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_gerattrs = (char **)value;
        }
        break;
    case SLAPI_SEARCH_REQATTRS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_searchattrs = (char **)value;
        }
        break;
    case SLAPI_SEARCH_ATTRSONLY:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_attrsonly = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_IS_AND:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_is_and = *((int *)value);
        }
        break;

    /* abandon operation arguments */
    case SLAPI_ABANDON_MSGID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_abandon.abandon_targetmsgid = *((int *)value);
        }
        break;

    /* extended operation arguments */
    case SLAPI_EXT_OP_REQ_OID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_extended.exop_oid = (char *)value;
        }
        break;
    case SLAPI_EXT_OP_REQ_VALUE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_extended.exop_value = (struct berval *)value;
        }
        break;
    /* extended operation return values */
    case SLAPI_EXT_OP_RET_OID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_extended.exop_ret_oid = (char *)value;
        }
        break;
    case SLAPI_EXT_OP_RET_VALUE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_extended.exop_ret_value = (struct berval *)value;
        }
        break;

    /* matching rule plugin functions */
    case SLAPI_PLUGIN_MR_FILTER_CREATE_FN:
        SLAPI_PLUGIN_TYPE_CHECK(pblock, SLAPI_PLUGIN_MATCHINGRULE);
        pblock->pb_plugin->plg_mr_filter_create = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_INDEXER_CREATE_FN:
        SLAPI_PLUGIN_TYPE_CHECK(pblock, SLAPI_PLUGIN_MATCHINGRULE);
        pblock->pb_plugin->plg_mr_indexer_create = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_match_fn = (mrFilterMatchFn)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_index_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_reset_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_INDEX_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->index_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_INDEX_SV_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->index_sv_fn = (IFP)value;
        break;

    /* matching rule plugin arguments */
    case SLAPI_PLUGIN_MR_OID:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->oid = (char *)value;
        break;
    case SLAPI_PLUGIN_MR_TYPE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->type = (char *)value;
        break;
    case SLAPI_PLUGIN_MR_VALUE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->value = (struct berval *)value;
        break;
    case SLAPI_PLUGIN_MR_VALUES:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->values = (struct berval **)value;
        break;
    case SLAPI_PLUGIN_MR_KEYS:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->keys = (struct berval **)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_reusable = *(unsigned int *)value;
        break;
    case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->query_operator = *(int *)value;
        break;
    case SLAPI_PLUGIN_MR_USAGE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->usage = *(unsigned int *)value;
        break;

    /* new style matching rule syntax plugin functions */
    case SLAPI_PLUGIN_MR_FILTER_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_filter_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_filter_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_VALUES2KEYS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_values2keys = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_assertion2keys_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_assertion2keys_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FLAGS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_flags = *((int *)value);
        break;
    case SLAPI_PLUGIN_MR_NAMES:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        PR_ASSERT(pblock->pb_plugin->plg_mr_names == NULL);
        pblock->pb_plugin->plg_mr_names = slapi_ch_array_dup((char **)value);
        break;
    case SLAPI_PLUGIN_MR_COMPARE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_compare = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_NORMALIZE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_normalize = (VFPV)value;
        break;

    /* seq arguments */
    case SLAPI_SEQ_TYPE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->seq_type = *((int *)value);
        break;
    case SLAPI_SEQ_ATTRNAME:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->seq_attrname = (char *)value;
        break;
    case SLAPI_SEQ_VAL:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->seq_val = (char *)value;
        break;

    /* ldif2db arguments */
    case SLAPI_LDIF2DB_FILE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_files = (char **)value;
        break;
    case SLAPI_LDIF2DB_REMOVEDUPVALS:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->removedupvals = *((int *)value);
        break;
    case SLAPI_DB2INDEX_ATTRS:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->db2index_attrs = (char **)value;
        break;
    case SLAPI_LDIF2DB_NOATTRINDEXES:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif2db_noattrindexes = *((int *)value);
        break;
    case SLAPI_LDIF2DB_INCLUDE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_include = (char **)value;
        break;
    case SLAPI_LDIF2DB_EXCLUDE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_exclude = (char **)value;
        break;
    case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_generate_uniqueid = *((int *)value);
        break;
    case SLAPI_LDIF2DB_NAMESPACEID:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_namespaceid = (char *)value;
        break;

    /* db2ldif arguments */
    case SLAPI_DB2LDIF_PRINTKEY:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_printkey = *((int *)value);
        break;
    case SLAPI_DB2LDIF_DUMP_UNIQUEID:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_dump_uniqueid = *((int *)value);
        break;
    case SLAPI_DB2LDIF_FILE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_file = (char *)value;
        break;

    /* db2ldif/ldif2db/db2bak/bak2db arguments */
    case SLAPI_BACKEND_INSTANCE_NAME:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->instance_name = (char *)value;
        break;
    case SLAPI_BACKEND_TASK:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->task = (Slapi_Task *)value;
        break;
    case SLAPI_TASK_FLAGS:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->task_flags = *((int *)value);
        break;
    case SLAPI_DB2LDIF_SERVER_RUNNING:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->server_running = *((int *)value);
        break;
    case SLAPI_BULK_IMPORT_ENTRY:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->import_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_BULK_IMPORT_STATE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->import_state = *((int *)value);
        break;

    case SLAPI_LDIF_CHANGELOG:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_include_changelog = *((int *)value);
        break;

    case SLAPI_LDIF2DB_ENCRYPT:
    case SLAPI_DB2LDIF_DECRYPT:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_encrypt = *((int *)value);
        break;
    /* dbverify */
    case SLAPI_DBVERIFY_DBDIR:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->dbverify_dbdir = (char *)value;
        break;


    /* transaction arguments */
    case SLAPI_PARENT_TXN:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_parent_txn = (void *)value;
        break;
    case SLAPI_TXN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_txn = (void *)value;
        break;
    case SLAPI_TXN_RUV_MODS_FN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_txn_ruv_mods_fn = (IFP)value;
        break;

    /* Search results set */
    case SLAPI_SEARCH_RESULT_SET:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.search_result_set = (void *)value;
        }
        break;
    /* estimated search result set size */
    case SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.estimate = *(int *)value;
        }
        break;
    /* Search result - entry returned from iterating over result set */
    case SLAPI_SEARCH_RESULT_ENTRY:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.search_result_entry = (void *)value;
        }
        break;
    case SLAPI_SEARCH_RESULT_ENTRY_EXT:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.opaque_backend_ptr = (void *)value;
        }
        break;
    /* Number of entries returned from search */
    case SLAPI_NENTRIES:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.nentries = *((int *)value);
        }
        break;
    /* Referrals encountered while iterating over the result set */
    case SLAPI_SEARCH_REFERRALS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.search_referrals = (struct berval **)value;
        }
        break;

    case SLAPI_RESULT_CODE:
        if (pblock->pb_op != NULL)
            pblock->pb_op->o_results.result_code = (*(int *)value);
        break;
    case SLAPI_RESULT_MATCHED:
        if (pblock->pb_op != NULL)
            pblock->pb_op->o_results.result_matched = (char *)value;
        break;
    case SLAPI_RESULT_TEXT:
        if (pblock->pb_op != NULL)
            pblock->pb_op->o_results.result_text = (char *)value;
        break;
    case SLAPI_PB_RESULT_TEXT:
        _pblock_assert_pb_intop(pblock);
        slapi_ch_free((void **)&(pblock->pb_intop->pb_result_text));
        pblock->pb_intop->pb_result_text = slapi_ch_strdup((char *)value);
        break;

    /* Size of the database, in kb */
    case SLAPI_DBSIZE:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_dbsize = *((unsigned int *)value);
        break;

    /* ACL Plugin */
    case SLAPI_PLUGIN_ACL_INIT:
        pblock->pb_plugin->plg_acl_init = (IFP)value;
        break;

    case SLAPI_PLUGIN_ACL_SYNTAX_CHECK:
        pblock->pb_plugin->plg_acl_syntax_check = (IFP)value;
        break;
    case SLAPI_PLUGIN_ACL_ALLOW_ACCESS:
        pblock->pb_plugin->plg_acl_access_allowed = (IFP)value;
        break;
    case SLAPI_PLUGIN_ACL_MODS_ALLOWED:
        pblock->pb_plugin->plg_acl_mods_allowed = (IFP)value;
        break;
    case SLAPI_PLUGIN_ACL_MODS_UPDATE:
        pblock->pb_plugin->plg_acl_mods_update = (IFP)value;
        break;
    /* MMR Plugin */
    case SLAPI_PLUGIN_MMR_BETXN_PREOP:
	pblock->pb_plugin->plg_mmr_betxn_preop = (IFP) value;
	break;
    case SLAPI_PLUGIN_MMR_BETXN_POSTOP:
	pblock->pb_plugin->plg_mmr_betxn_postop = (IFP) value;
	break;

    case SLAPI_CLIENT_DNS:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n");
            return (-1);
        }
        pblock->pb_conn->c_domain = *((struct berval ***)value);
        break;
    /* Command line arguments */
    case SLAPI_ARGC:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_slapd_argc = *((int *)value);
        break;
    case SLAPI_ARGV:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_slapd_argv = *((char ***)value);
        break;

    /* Config file directory */
    case SLAPI_CONFIG_DIRECTORY:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_slapd_configdir = (char *)value;
        break;

    /* password storage scheme (kexcoff) */
    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME:
        if (pblock->pb_plugin->plg_pwdstorageschemename != NULL) {
            /* Free the old name. */
            slapi_ch_free_string(&pblock->pb_plugin->plg_pwdstorageschemename);
        }
        pblock->pb_plugin->plg_pwdstorageschemename = slapi_ch_strdup((char *)value);
        break;
    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_pwd_storage_scheme_user_passwd = (char *)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_pwd_storage_scheme_db_passwd = (char *)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_ENC_FN:
        pblock->pb_plugin->plg_pwdstorageschemeenc = (CFP)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DEC_FN:
        pblock->pb_plugin->plg_pwdstorageschemedec = (IFP)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN:
        /* must provide a comparison function */
        if (value == NULL) {
            return (-1);
        }
        pblock->pb_plugin->plg_pwdstorageschemecmp = (IFP)value;
        break;

    /* entry fetch store */
    case SLAPI_PLUGIN_ENTRY_FETCH_FUNC:
        pblock->pb_plugin->plg_entryfetchfunc = (IFP)value;
        break;

    case SLAPI_PLUGIN_ENTRY_STORE_FUNC:
        pblock->pb_plugin->plg_entrystorefunc = (IFP)value;
        break;

    case SLAPI_PLUGIN_ENABLED:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_plugin_enabled = *((int *)value);
        break;

    /* DSE add parameters */
    case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->dont_add_write = *((int *)value);
        break;

    /* DSE add parameters */
    case SLAPI_DSE_MERGE_WHEN_ADDING:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->add_merge = *((int *)value);
        break;

    /* DSE add parameters */
    case SLAPI_DSE_DONT_CHECK_DUPS:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->dont_check_dups = *((int *)value);
        break;

    /* DSE modify parameters */
    case SLAPI_DSE_REAPPLY_MODS:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->reapply_mods = *((int *)value);
        break;

    /* DSE read parameters */
    case SLAPI_DSE_IS_PRIMARY_FILE:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->is_primary_file = *((int *)value);
        break;

    /* used internally by schema code (schema.c) */
    case SLAPI_SCHEMA_FLAGS:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->schema_flags = *((int *)value);
        break;

    case SLAPI_URP_NAMING_COLLISION_DN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_urp_naming_collision_dn = (char *)value;
        break;

    case SLAPI_URP_TOMBSTONE_CONFLICT_DN:
        pblock->pb_intop->pb_urp_tombstone_conflict_dn = (char *)value;
        break;

    case SLAPI_URP_TOMBSTONE_UNIQUEID:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_urp_tombstone_uniqueid = (char *)value;
        break;

    case SLAPI_SEARCH_CTRLS:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_search_ctrls = (LDAPControl **)value;
        break;

    case SLAPI_PLUGIN_SYNTAX_FILTER_NORMALIZED:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_syntax_filter_normalized = *((int *)value);
        break;

    case SLAPI_PLUGIN_SYNTAX_FILTER_DATA:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_syntax_filter_data = (void *)value;
        break;

    case SLAPI_PAGED_RESULTS_INDEX:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_paged_results_index = *(int *)value;
        break;

    case SLAPI_PAGED_RESULTS_COOKIE:
        pblock->pb_intop->pb_paged_results_cookie = *(int *)value;
        break;

    case SLAPI_USN_INCREMENT_FOR_TOMBSTONE:
        pblock->pb_intop->pb_usn_tombstone_incremented = *((int32_t *)value);
        break;

    /* ACI Target Check */
    case SLAPI_ACI_TARGET_CHECK:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_aci_target_check = *((int *)value);
        break;

    default:
        slapi_log_err(SLAPI_LOG_ERR, "slapi_pblock_set",
                      "Unknown parameter block argument %d\n", arg);
        PR_ASSERT(0);
        return (-1);
    }

    return (0);
}
slapi_pblock_set(Slapi_PBlock *pblock, int arg, void *value)
{
#ifdef PBLOCK_ANALYTICS
    pblock_analytics_record(pblock, arg);
#endif
    char *authtype;

    PR_ASSERT(NULL != pblock);

    switch (arg) {
#ifdef PBLOCK_ANALYTICS
    case SLAPI_HINT:
        break;
#endif
    case SLAPI_BACKEND:
        pblock->pb_backend = (Slapi_Backend *)value;
        if (pblock->pb_backend && (NULL == pblock->pb_plugin)) {
             
            pblock->pb_plugin =
                (struct slapdplugin *)pblock->pb_backend->be_database;
        }
        break;
    case SLAPI_BACKEND_COUNT:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_backend_count = *((int *)value);
        break;
    case SLAPI_CONNECTION:
        pblock->pb_conn = (Connection *)value;
        break;
    case SLAPI_OPERATION:
        pblock->pb_op = (Operation *)value;
        break;
    case SLAPI_OPINITIATED_TIME:
        break;
    case SLAPI_REQUESTOR_ISROOT:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_requestor_isroot = *((int *)value);
        break;
    case SLAPI_IS_REPLICATED_OPERATION:
        PR_ASSERT(0);
        break;
    case SLAPI_OPERATION_PARAMETERS:
        PR_ASSERT(0);
        break;
    case SLAPI_CONN_ID:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CONN_ID \n");
            return (-1);
        }
        pblock->pb_conn->c_connid = *((uint64_t *)value);
        break;
    case SLAPI_CONN_DN:
         
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CONN_DN \n");
            return (-1);
        }
        slapi_pblock_get(pblock, SLAPI_CONN_AUTHMETHOD, &authtype);
        bind_credentials_set(pblock->pb_conn, authtype,
                             (char *)value, NULL, NULL, NULL, NULL);
        slapi_ch_free((void **)&authtype);
        break;
    case SLAPI_CONN_AUTHTYPE:  
    case SLAPI_CONN_AUTHMETHOD:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set",
                          "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        slapi_ch_free((void **)&pblock->pb_conn->c_authtype);
        pblock->pb_conn->c_authtype = slapi_ch_strdup((char *)value);
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_CLIENTNETADDR_ACLIP:
        if (pblock->pb_conn == NULL) {
            break;
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        slapi_ch_free((void **)&pblock->pb_conn->cin_addr_aclip);
        pblock->pb_conn->cin_addr_aclip = (PRNetAddr *)value;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_IS_REPLICATION_SESSION:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set",
                          "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        pblock->pb_conn->c_isreplication_session = *((int *)value);
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;

     
    case SLAPI_CONFIG_FILENAME:
    case SLAPI_CONFIG_LINENO:
    case SLAPI_CONFIG_ARGC:
    case SLAPI_CONFIG_ARGV:
        return (-1);  

     
    case SLAPI_DESTROY_CONTENT:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_destroy_content = *((int *)value);
        break;

     
    case SLAPI_PLUGIN:
        pblock->pb_plugin = (struct slapdplugin *)value;
        break;
    case SLAPI_PLUGIN_PRIVATE:
        pblock->pb_plugin->plg_private = (void *)value;
        break;
    case SLAPI_PLUGIN_TYPE:
        pblock->pb_plugin->plg_type = *((int *)value);
        break;
    case SLAPI_PLUGIN_ARGV:
        pblock->pb_plugin->plg_argv = (char **)value;
        break;
    case SLAPI_PLUGIN_ARGC:
        pblock->pb_plugin->plg_argc = *((int *)value);
        break;
    case SLAPI_PLUGIN_VERSION:
        pblock->pb_plugin->plg_version = (char *)value;
        break;
    case SLAPI_PLUGIN_PRECEDENCE:
        pblock->pb_plugin->plg_precedence = *((int *)value);
        break;
    case SLAPI_PLUGIN_OPRETURN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_opreturn = *((int *)value);
        break;
    case SLAPI_PLUGIN_OBJECT:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_object = (void *)value;
        break;
    case SLAPI_PLUGIN_IDENTITY:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_plugin_identity = (void *)value;
        break;
    case SLAPI_PLUGIN_CONFIG_AREA:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_plugin_config_area = (char *)value;
        break;
    case SLAPI_PLUGIN_DESTROY_FN:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_destroy_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_DESCRIPTION:
        pblock->pb_plugin->plg_desc = *((Slapi_PluginDesc *)value);
        break;
    case SLAPI_PLUGIN_INTOP_RESULT:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_internal_op_result = *((int *)value);
        break;
    case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_plugin_internal_search_op_entries = (Slapi_Entry **)value;
        break;
    case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_plugin_internal_search_op_referrals = (char **)value;
        break;
    case SLAPI_REQUESTOR_DN:
        if (pblock->pb_op == NULL) {
            return (-1);
        }
        slapi_sdn_set_dn_byval((&pblock->pb_op->o_sdn), (char *)value);
        break;
    case SLAPI_REQUESTOR_SDN:
        if (pblock->pb_op == NULL) {
            return (-1);
        }
        slapi_sdn_set_dn_byval((&pblock->pb_op->o_sdn), slapi_sdn_get_dn((Slapi_DN *)value));
        break;
     
    case SLAPI_PLUGIN_DB_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_bind = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_unbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_search = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_next_search_entry = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_next_search_entry_ext = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_search_results_release = (VFPP)value;
        break;
    case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_prev_search_results = (VFP)value;
        break;
    case SLAPI_PLUGIN_DB_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_compare = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_modify = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_modrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_add = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_delete = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_abandon = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_CONFIG_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_config = (IFP)value;
        break;
    case SLAPI_PLUGIN_CLOSE_FN:
        pblock->pb_plugin->plg_close = (IFP)value;
        break;
    case SLAPI_PLUGIN_CLEANUP_FN:
        pblock->pb_plugin->plg_cleanup = (IFP)value;
        break;
    case SLAPI_PLUGIN_START_FN:
        pblock->pb_plugin->plg_start = (IFP)value;
        break;
    case SLAPI_PLUGIN_POSTSTART_FN:
        pblock->pb_plugin->plg_poststart = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:
        pblock->pb_plugin->plg_wire_import = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_GET_INFO_FN:
        pblock->pb_plugin->plg_get_info = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SET_INFO_FN:
        pblock->pb_plugin->plg_set_info = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_CTRL_INFO_FN:
        pblock->pb_plugin->plg_ctrl_info = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_SEQ_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_seq = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ENTRY_FN:
        pblock->pb_plugin->plg_entry = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_REFERRAL_FN:
        pblock->pb_plugin->plg_referral = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_RESULT_FN:
        pblock->pb_plugin->plg_result = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_RMDB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_rmdb = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_LDIF2DB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_ldif2db = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DB2LDIF_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_db2ldif = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DB2INDEX_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_db2index = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_archive2db = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_db2archive = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_UPGRADEDB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_upgradedb = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_UPGRADEDNFORMAT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_upgradednformat = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_DBVERIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_dbverify = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_BEGIN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_begin = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_COMMIT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_commit = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_ABORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort = (IFP)value;
        break;
    case SLAPI_PLUGIN_DB_TEST_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbtest = (IFP)value;
        break;
     
    case SLAPI_PLUGIN_DB_NO_ACL:
        if (pblock->pb_plugin && pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        if (NULL == pblock->pb_backend) {
            return (-1);
        }
        pblock->pb_backend->be_noacl = *((int *)value);
        break;
    case SLAPI_PLUGIN_DB_COMPACT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        pblock->pb_plugin->plg_dbcompact = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_EXT_OP_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_exhandler = (IFP)value;
        break;
    case SLAPI_PLUGIN_EXT_OP_OIDLIST:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_exoids = (char **)value;
        ldapi_register_extended_op((char **)value);
        break;
    case SLAPI_PLUGIN_EXT_OP_NAMELIST:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_exnames = (char **)value;
        break;
    case SLAPI_PLUGIN_EXT_OP_BACKEND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_EXTENDEDOP &&
            pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNEXTENDEDOP) {
            return (-1);
        }
        pblock->pb_plugin->plg_be_exhandler = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_PRE_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_prebind = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preunbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_presearch = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_precompare = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_premodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_premodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_predelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preabandon = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preentry = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_REFERRAL_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_prereferral = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_RESULT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preresult = (IFP)value;
        break;
    case SLAPI_PLUGIN_PRE_EXTOP_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_PREEXTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_preextop = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_POST_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postunbind = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postsearch = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_SEARCH_FAIL_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postsearchfail = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postcompare = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postmodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postmodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postdelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postabandon = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postentry = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_REFERRAL_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postreferral = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_RESULT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postresult = (IFP)value;
        break;
    case SLAPI_PLUGIN_POST_EXTOP_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_POSTEXTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_postextop = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_BE_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepremodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepremodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepreadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepredelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_PRE_CLOSE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepreclose = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_BE_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostmodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostmodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostdelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_OPEN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostopen = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_EXPORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostexport = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_POST_IMPORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_bepostimport = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_INTERNAL_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_modify = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_modrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_add = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_delete = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_PRE_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_pre_bind = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_INTERNAL_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_modify = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_modrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_add = (IFP)value;
        break;
    case SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_POSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_internal_post_delete = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_BE_TXN_PRE_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpremodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpremodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpreadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpredelete = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_PRE_DELETE_TOMBSTONE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPREOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpredeletetombstone = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostmodify = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostmodrdn = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_POST_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostadd = (IFP)value;
        break;
    case SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BETXNPOSTOPERATION) {
            return (-1);
        }
        pblock->pb_plugin->plg_betxnpostdelete = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_SYNTAX_FILTER_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_filter_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_FILTER_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_filter_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_VALUES2KEYS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_values2keys = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_assertion2keys_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_ASSERTION2KEYS_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_assertion2keys_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_NAMES:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        PR_ASSERT(pblock->pb_plugin->plg_syntax_names == NULL);
        pblock->pb_plugin->plg_syntax_names = slapi_ch_array_dup((char **)value);
        break;
    case SLAPI_PLUGIN_SYNTAX_OID:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        PR_ASSERT(pblock->pb_plugin->plg_syntax_oid == NULL);
        pblock->pb_plugin->plg_syntax_oid = slapi_ch_strdup((char *)value);
        break;
    case SLAPI_PLUGIN_SYNTAX_FLAGS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_flags = *((int *)value);
        break;
    case SLAPI_PLUGIN_SYNTAX_COMPARE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_compare = (IFP)value;
        break;
    case SLAPI_SYNTAX_SUBSTRLENS:  
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_substrlens = (int *)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_VALIDATE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_validate = (IFP)value;
        break;
    case SLAPI_PLUGIN_SYNTAX_NORMALIZE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_SYNTAX) {
            return (-1);
        }
        pblock->pb_plugin->plg_syntax_normalize = (VFPV)value;
        break;
    case SLAPI_ENTRY_PRE_OP:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_pre_op_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ENTRY_POST_OP:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_post_op_entry = (Slapi_Entry *)value;
        break;

     
    case SLAPI_TARGET_ADDRESS:
        PR_ASSERT(PR_FALSE);  
        break;
    case SLAPI_TARGET_DN:  
         
        if (pblock->pb_op != NULL) {
            Slapi_DN *sdn = pblock->pb_op->o_params.target_address.sdn;
            slapi_sdn_free(&sdn);
            pblock->pb_op->o_params.target_address.sdn = slapi_sdn_new_dn_byval((char *)value);
        } else {
            return (-1);
        }
        break;
    case SLAPI_TARGET_SDN:  
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.target_address.sdn = (Slapi_DN *)value;
        } else {
            return (-1);
        }
        break;
    case SLAPI_ORIGINAL_TARGET_DN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.target_address.udn = (char *)value;
        }
        break;
    case SLAPI_TARGET_UNIQUEID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.target_address.uniqueid = (char *)value;
        }
        break;
    case SLAPI_REQCONTROLS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.request_controls = (LDAPControl **)value;
        }
        break;
    case SLAPI_RESCONTROLS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.result_controls = (LDAPControl **)value;
        }
        break;
    case SLAPI_CONTROLS_ARG:  
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_ctrls_arg = (LDAPControl **)value;
        break;
    case SLAPI_ADD_RESCONTROL:
        if (pblock->pb_op != NULL) {
            add_control(&pblock->pb_op->o_results.result_controls, (LDAPControl *)value);
        }
        break;

     
    case SLAPI_OPERATION_NOTES:
        _pblock_assert_pb_intop(pblock);
        if (value == NULL) {
            pblock->pb_intop->pb_operation_notes = 0;  
        } else {
            pblock->pb_intop->pb_operation_notes |= *((unsigned int *)value);
        }
        break;
    case SLAPI_SKIP_MODIFIED_ATTRS:
        if (pblock->pb_op == NULL)
            break;
        if (value == 0) {
            pblock->pb_op->o_flags &= ~OP_FLAG_SKIP_MODIFIED_ATTRS;
        } else {
            pblock->pb_op->o_flags |= OP_FLAG_SKIP_MODIFIED_ATTRS;
        }
        break;
     
    case SLAPI_MANAGEDSAIT:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_managedsait = *((int *)value);
        break;
    case SLAPI_PWPOLICY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_pwpolicy_ctrl = *((int *)value);
        break;

     
    case SLAPI_ADD_ENTRY:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_add.target_entry = (Slapi_Entry *)value;
        }
        break;
    case SLAPI_ADD_EXISTING_DN_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_existing_dn_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ADD_EXISTING_UNIQUEID_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_existing_uniqueid_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ADD_PARENT_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_parent_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_ADD_PARENT_UNIQUEID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_add.parentuniqueid = (char *)value;
        }
        break;

     
    case SLAPI_BIND_METHOD:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_bind.bind_method = *((ber_tag_t *)value);
        }
        break;
    case SLAPI_BIND_CREDENTIALS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_bind.bind_creds = (struct berval *)value;
        }
        break;
    case SLAPI_BIND_SASLMECHANISM:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_bind.bind_saslmechanism = (char *)value;
        }
        break;
     
    case SLAPI_BIND_RET_SASLCREDS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_bind.bind_ret_saslcreds = (struct berval *)value;
        }
        break;

     
    case SLAPI_COMPARE_TYPE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_compare.compare_ava.ava_type = (char *)value;
        }
        break;
    case SLAPI_COMPARE_VALUE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_compare.compare_ava.ava_value = *((struct berval *)value);
        }
        break;

     
    case SLAPI_MODIFY_MODS:
        PR_ASSERT(pblock->pb_op);
        if (pblock->pb_op != NULL) {
            if (pblock->pb_op->o_params.operation_type == SLAPI_OPERATION_MODIFY) {
                pblock->pb_op->o_params.p.p_modify.modify_mods = (LDAPMod **)value;
            } else if (pblock->pb_op->o_params.operation_type == SLAPI_OPERATION_MODRDN) {
                pblock->pb_op->o_params.p.p_modrdn.modrdn_mods = (LDAPMod **)value;
            } else {
                PR_ASSERT(0);
            }
        }
        break;

     
    case SLAPI_MODRDN_NEWRDN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_modrdn.modrdn_newrdn = (char *)value;
        }
        break;
    case SLAPI_MODRDN_DELOLDRDN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_modrdn.modrdn_deloldrdn = *((int *)value);
        }
        break;
    case SLAPI_MODRDN_NEWSUPERIOR:  
        if (pblock->pb_op != NULL) {
            Slapi_DN *sdn =
                pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn;
            slapi_sdn_free(&sdn);
            pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn =
                slapi_sdn_new_dn_byval((char *)value);
        } else {
            return -1;
        }
        break;
    case SLAPI_MODRDN_NEWSUPERIOR_SDN:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn =
                (Slapi_DN *)value;
        } else {
            return -1;
        }
        break;
    case SLAPI_MODRDN_PARENT_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_parent_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_MODRDN_NEWPARENT_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_newparent_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_MODRDN_TARGET_ENTRY:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_target_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
        PR_ASSERT(PR_FALSE);  
        break;
     
    case SLAPI_SEARCH_SCOPE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_scope = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_DEREF:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_deref = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_SIZELIMIT:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_sizelimit = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_TIMELIMIT:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_timelimit = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_FILTER:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_filter = (struct slapi_filter *)value;
        }
        break;
    case SLAPI_SEARCH_STRFILTER:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_strfilter = (char *)value;
        }
        break;
    case SLAPI_SEARCH_ATTRS:
        if (pblock->pb_op != NULL) {
#if defined(USE_OLD_UNHASHED)
            char **attrs;
            for (attrs = (char **)value; attrs && *attrs; attrs++) {
                 
                if (is_type_forbidden(*attrs)) {
                    char **ptr;
                    for (ptr = attrs; ptr && *ptr; ptr++) {
                        if (ptr == attrs) {
                            slapi_ch_free_string(ptr);  
                        }
                        *ptr = *(ptr + 1);  
                    }
                }
            }
#endif
            pblock->pb_op->o_params.p.p_search.search_attrs = (char **)value;
        }
        break;
    case SLAPI_SEARCH_GERATTRS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_gerattrs = (char **)value;
        }
        break;
    case SLAPI_SEARCH_REQATTRS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_searchattrs = (char **)value;
        }
        break;
    case SLAPI_SEARCH_ATTRSONLY:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_attrsonly = *((int *)value);
        }
        break;
    case SLAPI_SEARCH_IS_AND:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_search.search_is_and = *((int *)value);
        }
        break;

     
    case SLAPI_ABANDON_MSGID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_abandon.abandon_targetmsgid = *((int *)value);
        }
        break;

     
    case SLAPI_EXT_OP_REQ_OID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_extended.exop_oid = (char *)value;
        }
        break;
    case SLAPI_EXT_OP_REQ_VALUE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_params.p.p_extended.exop_value = (struct berval *)value;
        }
        break;
     
    case SLAPI_EXT_OP_RET_OID:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_extended.exop_ret_oid = (char *)value;
        }
        break;
    case SLAPI_EXT_OP_RET_VALUE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_extended.exop_ret_value = (struct berval *)value;
        }
        break;

     
    case SLAPI_PLUGIN_MR_FILTER_CREATE_FN:
        SLAPI_PLUGIN_TYPE_CHECK(pblock, SLAPI_PLUGIN_MATCHINGRULE);
        pblock->pb_plugin->plg_mr_filter_create = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_INDEXER_CREATE_FN:
        SLAPI_PLUGIN_TYPE_CHECK(pblock, SLAPI_PLUGIN_MATCHINGRULE);
        pblock->pb_plugin->plg_mr_indexer_create = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_MATCH_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_match_fn = (mrFilterMatchFn)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_INDEX_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_index_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_RESET_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_reset_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_INDEX_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->index_fn = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_INDEX_SV_FN:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->index_sv_fn = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_MR_OID:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->oid = (char *)value;
        break;
    case SLAPI_PLUGIN_MR_TYPE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->type = (char *)value;
        break;
    case SLAPI_PLUGIN_MR_VALUE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->value = (struct berval *)value;
        break;
    case SLAPI_PLUGIN_MR_VALUES:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->values = (struct berval **)value;
        break;
    case SLAPI_PLUGIN_MR_KEYS:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->keys = (struct berval **)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->filter_reusable = *(unsigned int *)value;
        break;
    case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->query_operator = *(int *)value;
        break;
    case SLAPI_PLUGIN_MR_USAGE:
        _pblock_assert_pb_mr(pblock);
        pblock->pb_mr->usage = *(unsigned int *)value;
        break;

     
    case SLAPI_PLUGIN_MR_FILTER_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_filter_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FILTER_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_filter_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_VALUES2KEYS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_values2keys = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_assertion2keys_ava = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_assertion2keys_sub = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_FLAGS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_flags = *((int *)value);
        break;
    case SLAPI_PLUGIN_MR_NAMES:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        PR_ASSERT(pblock->pb_plugin->plg_mr_names == NULL);
        pblock->pb_plugin->plg_mr_names = slapi_ch_array_dup((char **)value);
        break;
    case SLAPI_PLUGIN_MR_COMPARE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_compare = (IFP)value;
        break;
    case SLAPI_PLUGIN_MR_NORMALIZE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        pblock->pb_plugin->plg_mr_normalize = (VFPV)value;
        break;

     
    case SLAPI_SEQ_TYPE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->seq_type = *((int *)value);
        break;
    case SLAPI_SEQ_ATTRNAME:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->seq_attrname = (char *)value;
        break;
    case SLAPI_SEQ_VAL:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->seq_val = (char *)value;
        break;

     
    case SLAPI_LDIF2DB_FILE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_files = (char **)value;
        break;
    case SLAPI_LDIF2DB_REMOVEDUPVALS:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->removedupvals = *((int *)value);
        break;
    case SLAPI_DB2INDEX_ATTRS:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->db2index_attrs = (char **)value;
        break;
    case SLAPI_LDIF2DB_NOATTRINDEXES:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif2db_noattrindexes = *((int *)value);
        break;
    case SLAPI_LDIF2DB_INCLUDE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_include = (char **)value;
        break;
    case SLAPI_LDIF2DB_EXCLUDE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_exclude = (char **)value;
        break;
    case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_generate_uniqueid = *((int *)value);
        break;
    case SLAPI_LDIF2DB_NAMESPACEID:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_namespaceid = (char *)value;
        break;

     
    case SLAPI_DB2LDIF_PRINTKEY:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_printkey = *((int *)value);
        break;
    case SLAPI_DB2LDIF_DUMP_UNIQUEID:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_dump_uniqueid = *((int *)value);
        break;
    case SLAPI_DB2LDIF_FILE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_file = (char *)value;
        break;

     
    case SLAPI_BACKEND_INSTANCE_NAME:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->instance_name = (char *)value;
        break;
    case SLAPI_BACKEND_TASK:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->task = (Slapi_Task *)value;
        break;
    case SLAPI_TASK_FLAGS:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->task_flags = *((int *)value);
        break;
    case SLAPI_DB2LDIF_SERVER_RUNNING:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->server_running = *((int *)value);
        break;
    case SLAPI_BULK_IMPORT_ENTRY:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->import_entry = (Slapi_Entry *)value;
        break;
    case SLAPI_BULK_IMPORT_STATE:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->import_state = *((int *)value);
        break;

    case SLAPI_LDIF_CHANGELOG:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_include_changelog = *((int *)value);
        break;

    case SLAPI_LDIF2DB_ENCRYPT:
    case SLAPI_DB2LDIF_DECRYPT:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->ldif_encrypt = *((int *)value);
        break;
     
    case SLAPI_DBVERIFY_DBDIR:
        _pblock_assert_pb_task(pblock);
        pblock->pb_task->dbverify_dbdir = (char *)value;
        break;


     
    case SLAPI_PARENT_TXN:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_parent_txn = (void *)value;
        break;
    case SLAPI_TXN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_txn = (void *)value;
        break;
    case SLAPI_TXN_RUV_MODS_FN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_txn_ruv_mods_fn = (IFP)value;
        break;

     
    case SLAPI_SEARCH_RESULT_SET:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.search_result_set = (void *)value;
        }
        break;
     
    case SLAPI_SEARCH_RESULT_SET_SIZE_ESTIMATE:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.estimate = *(int *)value;
        }
        break;
     
    case SLAPI_SEARCH_RESULT_ENTRY:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.search_result_entry = (void *)value;
        }
        break;
    case SLAPI_SEARCH_RESULT_ENTRY_EXT:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.opaque_backend_ptr = (void *)value;
        }
        break;
     
    case SLAPI_NENTRIES:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.nentries = *((int *)value);
        }
        break;
     
    case SLAPI_SEARCH_REFERRALS:
        if (pblock->pb_op != NULL) {
            pblock->pb_op->o_results.r.r_search.search_referrals = (struct berval **)value;
        }
        break;

    case SLAPI_RESULT_CODE:
        if (pblock->pb_op != NULL)
            pblock->pb_op->o_results.result_code = (*(int *)value);
        break;
    case SLAPI_RESULT_MATCHED:
        if (pblock->pb_op != NULL)
            pblock->pb_op->o_results.result_matched = (char *)value;
        break;
    case SLAPI_RESULT_TEXT:
        if (pblock->pb_op != NULL)
            pblock->pb_op->o_results.result_text = (char *)value;
        break;
    case SLAPI_PB_RESULT_TEXT:
        _pblock_assert_pb_intop(pblock);
        slapi_ch_free((void **)&(pblock->pb_intop->pb_result_text));
        pblock->pb_intop->pb_result_text = slapi_ch_strdup((char *)value);
        break;

     
    case SLAPI_DBSIZE:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_dbsize = *((unsigned int *)value);
        break;

     
    case SLAPI_PLUGIN_ACL_INIT:
        pblock->pb_plugin->plg_acl_init = (IFP)value;
        break;

    case SLAPI_PLUGIN_ACL_SYNTAX_CHECK:
        pblock->pb_plugin->plg_acl_syntax_check = (IFP)value;
        break;
    case SLAPI_PLUGIN_ACL_ALLOW_ACCESS:
        pblock->pb_plugin->plg_acl_access_allowed = (IFP)value;
        break;
    case SLAPI_PLUGIN_ACL_MODS_ALLOWED:
        pblock->pb_plugin->plg_acl_mods_allowed = (IFP)value;
        break;
    case SLAPI_PLUGIN_ACL_MODS_UPDATE:
        pblock->pb_plugin->plg_acl_mods_update = (IFP)value;
        break;
     
    case SLAPI_PLUGIN_MMR_BETXN_PREOP:
	pblock->pb_plugin->plg_mmr_betxn_preop = (IFP) value;
	break;
    case SLAPI_PLUGIN_MMR_BETXN_POSTOP:
	pblock->pb_plugin->plg_mmr_betxn_postop = (IFP) value;
	break;

    case SLAPI_CLIENT_DNS:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_set", "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n");
            return (-1);
        }
        pblock->pb_conn->c_domain = *((struct berval ***)value);
        break;
     
    case SLAPI_ARGC:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_slapd_argc = *((int *)value);
        break;
    case SLAPI_ARGV:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_slapd_argv = *((char ***)value);
        break;

     
    case SLAPI_CONFIG_DIRECTORY:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_slapd_configdir = (char *)value;
        break;

     
    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME:
        if (pblock->pb_plugin->plg_pwdstorageschemename != NULL) {
             
            slapi_ch_free_string(&pblock->pb_plugin->plg_pwdstorageschemename);
        }
        pblock->pb_plugin->plg_pwdstorageschemename = slapi_ch_strdup((char *)value);
        break;
    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_pwd_storage_scheme_user_passwd = (char *)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
        _pblock_assert_pb_deprecated(pblock);
        pblock->pb_deprecated->pb_pwd_storage_scheme_db_passwd = (char *)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_ENC_FN:
        pblock->pb_plugin->plg_pwdstorageschemeenc = (CFP)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DEC_FN:
        pblock->pb_plugin->plg_pwdstorageschemedec = (IFP)value;
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN:
         
        if (value == NULL) {
            return (-1);
        }
        pblock->pb_plugin->plg_pwdstorageschemecmp = (IFP)value;
        break;

     
    case SLAPI_PLUGIN_ENTRY_FETCH_FUNC:
        pblock->pb_plugin->plg_entryfetchfunc = (IFP)value;
        break;

    case SLAPI_PLUGIN_ENTRY_STORE_FUNC:
        pblock->pb_plugin->plg_entrystorefunc = (IFP)value;
        break;

    case SLAPI_PLUGIN_ENABLED:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_plugin_enabled = *((int *)value);
        break;

     
    case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->dont_add_write = *((int *)value);
        break;

     
    case SLAPI_DSE_MERGE_WHEN_ADDING:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->add_merge = *((int *)value);
        break;

     
    case SLAPI_DSE_DONT_CHECK_DUPS:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->dont_check_dups = *((int *)value);
        break;

     
    case SLAPI_DSE_REAPPLY_MODS:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->reapply_mods = *((int *)value);
        break;

     
    case SLAPI_DSE_IS_PRIMARY_FILE:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->is_primary_file = *((int *)value);
        break;

     
    case SLAPI_SCHEMA_FLAGS:
        _pblock_assert_pb_dse(pblock);
        pblock->pb_dse->schema_flags = *((int *)value);
        break;

    case SLAPI_URP_NAMING_COLLISION_DN:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_urp_naming_collision_dn = (char *)value;
        break;

    case SLAPI_URP_TOMBSTONE_CONFLICT_DN:
        pblock->pb_intop->pb_urp_tombstone_conflict_dn = (char *)value;
        break;

    case SLAPI_URP_TOMBSTONE_UNIQUEID:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_urp_tombstone_uniqueid = (char *)value;
        break;

    case SLAPI_SEARCH_CTRLS:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_search_ctrls = (LDAPControl **)value;
        break;

    case SLAPI_PLUGIN_SYNTAX_FILTER_NORMALIZED:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_syntax_filter_normalized = *((int *)value);
        break;

    case SLAPI_PLUGIN_SYNTAX_FILTER_DATA:
        _pblock_assert_pb_intplugin(pblock);
        pblock->pb_intplugin->pb_syntax_filter_data = (void *)value;
        break;

    case SLAPI_PAGED_RESULTS_INDEX:
        _pblock_assert_pb_intop(pblock);
        pblock->pb_intop->pb_paged_results_index = *(int *)value;
        break;

    case SLAPI_PAGED_RESULTS_COOKIE:
        pblock->pb_intop->pb_paged_results_cookie = *(int *)value;
        break;

    case SLAPI_USN_INCREMENT_FOR_TOMBSTONE:
        pblock->pb_intop->pb_usn_tombstone_incremented = *((int32_t *)value);
        break;

     
    case SLAPI_ACI_TARGET_CHECK:
        _pblock_assert_pb_misc(pblock);
        pblock->pb_misc->pb_aci_target_check = *((int *)value);
        break;

    default:
        slapi_log_err(SLAPI_LOG_ERR, "slapi_pblock_set",
                      "Unknown parameter block argument %d\n", arg);
        PR_ASSERT(0);
        return (-1);
    }

    return (0);
}