slapi_pblock_get(Slapi_PBlock *pblock, int arg, void *value)
{

#ifdef PBLOCK_ANALYTICS
    pblock_analytics_record(pblock, arg);
#endif

    char *authtype;
    Slapi_Backend *be;

    PR_ASSERT(NULL != pblock);
    PR_ASSERT(NULL != value);
    be = pblock->pb_backend;

    switch (arg) {
#ifdef PBLOCK_ANALYTICS
    case SLAPI_HINT:
        break;
#endif
    case SLAPI_BACKEND:
        (*(Slapi_Backend **)value) = be;
        break;
    case SLAPI_BACKEND_COUNT:
        if (pblock->pb_misc != NULL) {
            (*(int *)value) = pblock->pb_misc->pb_backend_count;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_BE_TYPE:
        if (NULL == be) {
            return (-1);
        }
        (*(char **)value) = be->be_type;
        break;
    case SLAPI_BE_READONLY:
        if (NULL == be) {
            (*(int *)value) = 0; /* default value */
        } else {
            (*(int *)value) = be->be_readonly;
        }
        break;
    case SLAPI_BE_LASTMOD:
        if (NULL == be) {
            (*(int *)value) = (g_get_global_lastmod() == LDAP_ON);
        } else {
            (*(int *)value) = (be->be_lastmod == LDAP_ON || (be->be_lastmod == LDAP_UNDEFINED && g_get_global_lastmod() == LDAP_ON));
        }
        break;
    case SLAPI_CONNECTION:
        (*(Connection **)value) = pblock->pb_conn;
        break;
    case SLAPI_CONN_ID:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_TRACE,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_ID \n");
            return (-1);
        }
        (*(uint64_t *)value) = pblock->pb_conn->c_connid;
        break;
    case SLAPI_CONN_DN:
        /*
         * NOTE: we have to make a copy of this that the caller
         * is responsible for freeing. otherwise, they would get
         * a pointer that could be freed out from under them.
         */
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_DN \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(char **)value) = (NULL == pblock->pb_conn->c_dn ? NULL : slapi_ch_strdup(pblock->pb_conn->c_dn));
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_AUTHTYPE: /* deprecated */
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_AUTHTYPE \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        authtype = pblock->pb_conn->c_authtype;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        if (authtype == NULL) {
            (*(char **)value) = NULL;
        } else if (strcasecmp(authtype, SLAPD_AUTH_NONE) == 0) {
            (*(char **)value) = SLAPD_AUTH_NONE;
        } else if (strcasecmp(authtype, SLAPD_AUTH_SIMPLE) == 0) {
            (*(char **)value) = SLAPD_AUTH_SIMPLE;
        } else if (strcasecmp(authtype, SLAPD_AUTH_SSL) == 0) {
            (*(char **)value) = SLAPD_AUTH_SSL;
        } else if (strcasecmp(authtype, SLAPD_AUTH_OS) == 0) {
            (*(char **)value) = SLAPD_AUTH_OS;
        } else if (strncasecmp(authtype, SLAPD_AUTH_SASL,
                               strlen(SLAPD_AUTH_SASL)) == 0) {
            (*(char **)value) = SLAPD_AUTH_SASL;
        } else {
            (*(char **)value) = "unknown";
        }
        break;
    case SLAPI_CONN_AUTHMETHOD:
        /* returns a copy */
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_AUTHMETHOD \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(char **)value) = pblock->pb_conn->c_authtype ? slapi_ch_strdup(pblock->pb_conn->c_authtype) : NULL;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_CLIENTNETADDR:
        if (pblock->pb_conn == NULL) {
            memset(value, 0, sizeof(PRNetAddr));
            break;
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        if (pblock->pb_conn->cin_addr == NULL) {
            memset(value, 0, sizeof(PRNetAddr));
        } else {
            (*(PRNetAddr *)value) =
                *(pblock->pb_conn->cin_addr);
        }
        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));
        (*(PRNetAddr **) value) = pblock->pb_conn->cin_addr_aclip;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_SERVERNETADDR:
        if (pblock->pb_conn == NULL) {
            memset(value, 0, sizeof(PRNetAddr));
            break;
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        if (pblock->pb_conn->cin_destaddr == NULL) {
            memset(value, 0, sizeof(PRNetAddr));
        } else {
            (*(PRNetAddr *)value) =
                *(pblock->pb_conn->cin_destaddr);
        }
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_CLIENTIP:
        if (pblock->pb_conn == NULL) {
            memset(value, 0, sizeof(struct in_addr));
            break;
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        if (pblock->pb_conn->cin_addr == NULL) {
            memset(value, 0, sizeof(struct in_addr));
        } else {

            if (PR_IsNetAddrType(pblock->pb_conn->cin_addr,
                                 PR_IpAddrV4Mapped)) {

                (*(struct in_addr *)value).s_addr =
                    (*(pblock->pb_conn->cin_addr)).ipv6.ip.pr_s6_addr32[3];

            } else {
                memset(value, 0, sizeof(struct in_addr));
            }
        }
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_SERVERIP:
        if (pblock->pb_conn == NULL) {
            memset(value, 0, sizeof(struct in_addr));
            break;
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        if (pblock->pb_conn->cin_destaddr == NULL) {
            memset(value, 0, sizeof(PRNetAddr));
        } else {

            if (PR_IsNetAddrType(pblock->pb_conn->cin_destaddr,
                                 PR_IpAddrV4Mapped)) {

                (*(struct in_addr *)value).s_addr =
                    (*(pblock->pb_conn->cin_destaddr)).ipv6.ip.pr_s6_addr32[3];

            } else {
                memset(value, 0, sizeof(struct in_addr));
            }
        }
        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_get", "Connection is NULL and hence cannot access SLAPI_CONN_IS_REPLICATION_SESSION \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(int *)value) = pblock->pb_conn->c_isreplication_session;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_IS_SSL_SESSION:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_IS_SSL_SESSION \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(int *)value) = pblock->pb_conn->c_flags & CONN_FLAG_SSL;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_SASL_SSF:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_SASL_SSF \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(int *)value) = pblock->pb_conn->c_sasl_ssf;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_SSL_SSF:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_SSL_SSF \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(int *)value) = pblock->pb_conn->c_ssl_ssf;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_LOCAL_SSF:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_LOCAL_SSF \n");
            return (-1);
        }
        pthread_mutex_lock(&(pblock->pb_conn->c_mutex));
        (*(int *)value) = pblock->pb_conn->c_local_ssf;
        pthread_mutex_unlock(&(pblock->pb_conn->c_mutex));
        break;
    case SLAPI_CONN_CERT:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CONN_CERT \n");
            return (-1);
        }
        (*(CERTCertificate **)value) = pblock->pb_conn->c_client_cert;
        break;
    case SLAPI_OPERATION:
        (*(Operation **)value) = pblock->pb_op;
        break;
    case SLAPI_OPERATION_TYPE:
        if (pblock->pb_op == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Operation is NULL and hence cannot access SLAPI_OPERATION_TYPE \n");
            return (-1);
        }
        (*(int *)value) = pblock->pb_op->o_params.operation_type;
        break;
    case SLAPI_OPINITIATED_TIME:
        if (pblock->pb_op == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Operation is NULL and hence cannot access SLAPI_OPINITIATED_TIME \n");
            return (-1);
        }
        (*(time_t *)value) = pblock->pb_op->o_hr_time_utc.tv_sec;
        break;
    case SLAPI_REQUESTOR_ISROOT:
        if (pblock->pb_intop != NULL) {
            (*(int *)value) = pblock->pb_intop->pb_requestor_isroot;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_SKIP_MODIFIED_ATTRS:
        if (pblock->pb_op == NULL) {
            (*(int *)value) = 0; /* No Operation -> No skip */
        } else {
            (*(int *)value) = (pblock->pb_op->o_flags & OP_FLAG_SKIP_MODIFIED_ATTRS);
        }
        break;
    case SLAPI_IS_REPLICATED_OPERATION:
        if (pblock->pb_op == NULL) {
            (*(int *)value) = 0; /* No Operation -> Not Replicated */
        } else {
            (*(int *)value) = (pblock->pb_op->o_flags & OP_FLAG_REPLICATED);
        }
        break;
    case SLAPI_IS_MMR_REPLICATED_OPERATION:
        if (pblock->pb_op == NULL) {
            (*(int *)value) = 0; /* No Operation -> Not Replicated */
        } else {
            (*(int *)value) = (pblock->pb_op->o_flags & OP_FLAG_REPLICATED);
        }
        break;

    case SLAPI_OPERATION_PARAMETERS:
        if (pblock->pb_op != NULL) {
            (*(struct slapi_operation_parameters **)value) = &pblock->pb_op->o_params;
        }
        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:
        if (pblock->pb_deprecated != NULL) {
            (*(int *)value) = pblock->pb_deprecated->pb_destroy_content;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* stuff related to the current plugin */
    case SLAPI_PLUGIN:
        (*(struct slapdplugin **)value) = pblock->pb_plugin;
        break;
    case SLAPI_PLUGIN_PRIVATE:
        (*(void **)value) = pblock->pb_plugin->plg_private;
        break;
    case SLAPI_PLUGIN_TYPE:
        (*(int *)value) = pblock->pb_plugin->plg_type;
        break;
    case SLAPI_PLUGIN_ARGV:
        (*(char ***)value) = pblock->pb_plugin->plg_argv;
        break;
    case SLAPI_PLUGIN_ARGC:
        (*(int *)value) = pblock->pb_plugin->plg_argc;
        break;
    case SLAPI_PLUGIN_VERSION:
        (*(char **)value) = pblock->pb_plugin->plg_version;
        break;
    case SLAPI_PLUGIN_PRECEDENCE:
        (*(int *)value) = pblock->pb_plugin->plg_precedence;
        break;
    case SLAPI_PLUGIN_OPRETURN:
        if (pblock->pb_intop != NULL) {
            (*(int *)value) = pblock->pb_intop->pb_opreturn;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_PLUGIN_OBJECT:
        if (pblock->pb_intplugin != NULL) {
            (*(void **)value) = pblock->pb_intplugin->pb_object;
        } else {
            (*(void **)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_DESTROY_FN:
        if (pblock->pb_intplugin != NULL) {
            (*(IFP *)value) = pblock->pb_intplugin->pb_destroy_fn;
        } else {
            (*(IFP *)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_DESCRIPTION:
        (*(Slapi_PluginDesc *)value) = pblock->pb_plugin->plg_desc;
        break;
    case SLAPI_PLUGIN_IDENTITY:
        if (pblock->pb_intplugin != NULL) {
            (*(void **)value) = pblock->pb_intplugin->pb_plugin_identity;
        } else {
            (*(void **)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_CONFIG_AREA:
        if (pblock->pb_intplugin != NULL) {
            (*(char **)value) = pblock->pb_intplugin->pb_plugin_config_area;
        } else {
            (*(char **)value) = 0;
        }
        break;
    case SLAPI_PLUGIN_CONFIG_DN:
        if (pblock->pb_plugin != NULL) {
            (*(char **)value) = pblock->pb_plugin->plg_dn;
        }
        break;
    case SLAPI_PLUGIN_INTOP_RESULT:
        if (pblock->pb_intop != NULL) {
            (*(int *)value) = pblock->pb_intop->pb_internal_op_result;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES:
        if (pblock->pb_intop != NULL) {
            (*(Slapi_Entry ***)value) = pblock->pb_intop->pb_plugin_internal_search_op_entries;
        } else {
            (*(Slapi_Entry ***)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_INTOP_SEARCH_REFERRALS:
        if (pblock->pb_intop != NULL) {
            (*(char ***)value) = pblock->pb_intop->pb_plugin_internal_search_op_referrals;
        } else {
            (*(char ***)value) = NULL;
        }
        break;

    /* database plugin functions */
    case SLAPI_PLUGIN_DB_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_bind;
        break;
    case SLAPI_PLUGIN_DB_UNBIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_unbind;
        break;
    case SLAPI_PLUGIN_DB_SEARCH_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_search;
        break;
    case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_next_search_entry;
        break;
    case SLAPI_PLUGIN_DB_NEXT_SEARCH_ENTRY_EXT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_next_search_entry_ext;
        break;
    case SLAPI_PLUGIN_DB_SEARCH_RESULTS_RELEASE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(VFPP *)value) = pblock->pb_plugin->plg_search_results_release;
        break;
    case SLAPI_PLUGIN_DB_PREV_SEARCH_RESULTS_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(VFP *)value) = pblock->pb_plugin->plg_prev_search_results;
        break;
    case SLAPI_PLUGIN_DB_COMPARE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_compare;
        break;
    case SLAPI_PLUGIN_DB_MODIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_modify;
        break;
    case SLAPI_PLUGIN_DB_MODRDN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_modrdn;
        break;
    case SLAPI_PLUGIN_DB_ADD_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_add;
        break;
    case SLAPI_PLUGIN_DB_DELETE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_delete;
        break;
    case SLAPI_PLUGIN_DB_ABANDON_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_abandon;
        break;
    case SLAPI_PLUGIN_DB_CONFIG_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_config;
        break;
    case SLAPI_PLUGIN_CLOSE_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_close;
        break;
    case SLAPI_PLUGIN_CLEANUP_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_cleanup;
        break;
    case SLAPI_PLUGIN_START_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_start;
        break;
    case SLAPI_PLUGIN_POSTSTART_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_poststart;
        break;
    case SLAPI_PLUGIN_DB_WIRE_IMPORT_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_wire_import;
        break;
    case SLAPI_PLUGIN_DB_GET_INFO_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_get_info;
        break;
    case SLAPI_PLUGIN_DB_SET_INFO_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_set_info;
        break;
    case SLAPI_PLUGIN_DB_CTRL_INFO_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_ctrl_info;
        break;
    case SLAPI_PLUGIN_DB_SEQ_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_seq;
        break;
    case SLAPI_PLUGIN_DB_ENTRY_FN:
        (*(IFP *)value) = SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER(pblock,
                                                                  plg_entry);
        break;
    case SLAPI_PLUGIN_DB_REFERRAL_FN:
        (*(IFP *)value) = SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER(pblock,
                                                                  plg_referral);
        break;
    case SLAPI_PLUGIN_DB_RESULT_FN:
        (*(IFP *)value) = SLAPI_PBLOCK_GET_PLUGIN_RELATED_POINTER(pblock,
                                                                  plg_result);
        break;
    case SLAPI_PLUGIN_DB_RMDB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_rmdb;
        break;
    case SLAPI_PLUGIN_DB_LDIF2DB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_ldif2db;
        break;
    case SLAPI_PLUGIN_DB_DB2LDIF_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_db2ldif;
        break;
    case SLAPI_PLUGIN_DB_COMPACT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_dbcompact;
        break;
    case SLAPI_PLUGIN_DB_DB2INDEX_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_db2index;
        break;
    case SLAPI_PLUGIN_DB_ARCHIVE2DB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_archive2db;
        break;
    case SLAPI_PLUGIN_DB_DB2ARCHIVE_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_db2archive;
        break;
    case SLAPI_PLUGIN_DB_UPGRADEDB_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_upgradedb;
        break;
    case SLAPI_PLUGIN_DB_UPGRADEDNFORMAT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_upgradednformat;
        break;
    case SLAPI_PLUGIN_DB_DBVERIFY_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_dbverify;
        break;
    case SLAPI_PLUGIN_DB_BEGIN_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_begin;
        break;
    case SLAPI_PLUGIN_DB_COMMIT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_commit;
        break;
    case SLAPI_PLUGIN_DB_ABORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_abort;
        break;
    case SLAPI_PLUGIN_DB_TEST_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_DATABASE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_un.plg_un_db.plg_un_db_dbtest;
        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 == be) {
            (*(int *)value) = 0; /* default value */
        } else {
            (*(int *)value) = be->be_noacl;
        }
        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);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_exhandler;
        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);
        }
        (*(char ***)value) = pblock->pb_plugin->plg_exoids;
        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);
        }
        (*(char ***)value) = pblock->pb_plugin->plg_exnames;
        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);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_be_exhandler;
        break;

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

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

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

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

    case SLAPI_PLUGIN_BE_POST_EXPORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_bepostexport;
        break;
    case SLAPI_PLUGIN_BE_POST_IMPORT_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_BEPOSTOPERATION) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_bepostimport;
        break;

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

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

    /* rootDN pre bind operation plugin */
    case SLAPI_PLUGIN_INTERNAL_PRE_BIND_FN:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_INTERNAL_PREOPERATION) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_internal_pre_bind;
        break;

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

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

    /* target address & controls for all operations should be normalized  */
    case SLAPI_TARGET_ADDRESS:
        if (pblock->pb_op != NULL) {
            (*(entry_address **)value) = &(pblock->pb_op->o_params.target_address);
        }
        break;
    case SLAPI_TARGET_DN: /* DEPRECATED */
        /* The returned value refers SLAPI_TARGET_SDN.
         * It should not be freed.*/
        if (pblock->pb_op != NULL) {
            Slapi_DN *sdn = pblock->pb_op->o_params.target_address.sdn;
            if (sdn) {
                (*(char **)value) = (char *)slapi_sdn_get_dn(sdn);
            } else {
                (*(char **)value) = NULL;
            }
        } else {
            return (-1);
        }
        break;
    case SLAPI_TARGET_SDN: /* Alias from SLAPI_ADD_TARGET_SDN */
        if (pblock->pb_op != NULL) {
            (*(Slapi_DN **)value) = pblock->pb_op->o_params.target_address.sdn;
        } else {
            return (-1);
        }
        break;
    case SLAPI_ORIGINAL_TARGET_DN:
        if (pblock->pb_op != NULL) {
            (*(char **)value) = pblock->pb_op->o_params.target_address.udn;
        }
        break;
    case SLAPI_TARGET_UNIQUEID:
        if (pblock->pb_op != NULL) {
            (*(char **)value) = pblock->pb_op->o_params.target_address.uniqueid;
        }
        break;
    case SLAPI_REQCONTROLS:
        if (pblock->pb_op != NULL) {
            (*(LDAPControl ***)value) = pblock->pb_op->o_params.request_controls;
        }
        break;
    case SLAPI_RESCONTROLS:
        if (pblock->pb_op != NULL) {
            (*(LDAPControl ***)value) = pblock->pb_op->o_results.result_controls;
        }
        break;
    case SLAPI_CONTROLS_ARG: /* used to pass control argument before operation is created */
        if (pblock->pb_intop != NULL) {
            (*(LDAPControl ***)value) = pblock->pb_intop->pb_ctrls_arg;
        } else {
            (*(LDAPControl ***)value) = NULL;
        }
        break;
    /* notes to be added to the access log RESULT line for this op. */
    case SLAPI_OPERATION_NOTES:
        if (pblock->pb_intop != NULL) {
            (*(unsigned int *)value) = pblock->pb_intop->pb_operation_notes;
        } else {
            (*(unsigned int *)value) = 0;
        }
        break;

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

    /* controls we know about */
    case SLAPI_MANAGEDSAIT:
        if (pblock->pb_intop != NULL) {
            (*(int *)value) = pblock->pb_intop->pb_managedsait;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_PWPOLICY:
        if (pblock->pb_intop != NULL) {
            (*(int *)value) = pblock->pb_intop->pb_pwpolicy_ctrl;
        } else {
            (*(int *)value) = 0;
        }
        break;

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

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

    /* compare arguments */
    case SLAPI_COMPARE_TYPE:
        if (pblock->pb_op != NULL) {
            (*(char **)value) = pblock->pb_op->o_params.p.p_compare.compare_ava.ava_type;
        }
        break;
    case SLAPI_COMPARE_VALUE:
        if (pblock->pb_op != NULL) {
            (*(struct berval **)value) = &pblock->pb_op->o_params.p.p_compare.compare_ava.ava_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) {
                (*(LDAPMod ***)value) = pblock->pb_op->o_params.p.p_modify.modify_mods;
            } else if (pblock->pb_op->o_params.operation_type == SLAPI_OPERATION_MODRDN) {
                (*(LDAPMod ***)value) = pblock->pb_op->o_params.p.p_modrdn.modrdn_mods;
            } else {
                PR_ASSERT(0); /* JCM */
            }
        }
        break;

    /* modrdn arguments */
    case SLAPI_MODRDN_NEWRDN:
        if (pblock->pb_op != NULL) {
            (*(char **)value) = pblock->pb_op->o_params.p.p_modrdn.modrdn_newrdn;
        }
        break;
    case SLAPI_MODRDN_DELOLDRDN:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_modrdn.modrdn_deloldrdn;
        }
        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;
            if (sdn) {
                (*(char **)value) = (char *)slapi_sdn_get_dn(sdn);
            } else {
                (*(char **)value) = NULL;
            }
        } else {
            return -1;
        }
        break;
    case SLAPI_MODRDN_NEWSUPERIOR_SDN:
        if (pblock->pb_op != NULL) {
            (*(Slapi_DN **)value) =
                pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address.sdn;
        } else {
            return -1;
        }
        break;
    case SLAPI_MODRDN_PARENT_ENTRY:
        if (pblock->pb_intop != NULL) {
            (*(Slapi_Entry **)value) = pblock->pb_intop->pb_parent_entry;
        } else {
            (*(Slapi_Entry **)value) = NULL;
        }
        break;
    case SLAPI_MODRDN_NEWPARENT_ENTRY:
        if (pblock->pb_intop != NULL) {
            (*(Slapi_Entry **)value) = pblock->pb_intop->pb_newparent_entry;
        } else {
            (*(Slapi_Entry **)value) = NULL;
        }
        break;
    case SLAPI_MODRDN_TARGET_ENTRY:
        if (pblock->pb_intop != NULL) {
            (*(Slapi_Entry **)value) = pblock->pb_intop->pb_target_entry;
        } else {
            (*(Slapi_Entry **)value) = NULL;
        }
        break;
    case SLAPI_MODRDN_NEWSUPERIOR_ADDRESS:
        if (pblock->pb_op != NULL) {
            (*(entry_address **)value) = &(pblock->pb_op->o_params.p.p_modrdn.modrdn_newsuperior_address);
        }
        break;

    /* search arguments */
    case SLAPI_SEARCH_SCOPE:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_scope;
        }
        break;
    case SLAPI_SEARCH_DEREF:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_deref;
        }
        break;
    case SLAPI_SEARCH_SIZELIMIT:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_sizelimit;
        }
        break;
    case SLAPI_SEARCH_TIMELIMIT:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_timelimit;
        }
        break;
    case SLAPI_SEARCH_FILTER:
        if (pblock->pb_op != NULL) {
            (*(struct slapi_filter **)value) = pblock->pb_op->o_params.p.p_search.search_filter;
        }
        break;
    case SLAPI_SEARCH_STRFILTER:
        if (pblock->pb_op != NULL) {
            (*(char **)value) = pblock->pb_op->o_params.p.p_search.search_strfilter;
        }
        break;
    case SLAPI_SEARCH_ATTRS:
        if (pblock->pb_op != NULL) {
            (*(char ***)value) = pblock->pb_op->o_params.p.p_search.search_attrs;
        }
        break;
    case SLAPI_SEARCH_GERATTRS:
        if (pblock->pb_op != NULL) {
            (*(char ***)value) = pblock->pb_op->o_params.p.p_search.search_gerattrs;
        }
        break;
    case SLAPI_SEARCH_REQATTRS:
        if (pblock->pb_op != NULL) {
            (*(char ***)value) = pblock->pb_op->o_searchattrs;
        }
        break;
    case SLAPI_SEARCH_ATTRSONLY:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_attrsonly;
        }
        break;
    case SLAPI_SEARCH_IS_AND:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_params.p.p_search.search_is_and;
        }
        break;

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

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

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

    /* matching rule plugin arguments */
    case SLAPI_PLUGIN_MR_OID:
        if (pblock->pb_mr != NULL) {
            (*(char **)value) = pblock->pb_mr->oid;
        } else {
            (*(char **)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_MR_TYPE:
        if (pblock->pb_mr != NULL) {
            (*(char **)value) = pblock->pb_mr->type;
        } else {
            (*(char **)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_MR_VALUE:
        if (pblock->pb_mr != NULL) {
            (*(struct berval **)value) = pblock->pb_mr->value;
        } else {
            (*(struct berval **)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_MR_VALUES:
        if (pblock->pb_mr != NULL) {
            (*(struct berval ***)value) = pblock->pb_mr->values;
        } else {
            (*(struct berval ***)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_MR_KEYS:
        if (pblock->pb_mr != NULL) {
            (*(struct berval ***)value) = pblock->pb_mr->keys;
        } else {
            (*(struct berval ***)value) = NULL;
        }
        break;
    case SLAPI_PLUGIN_MR_FILTER_REUSABLE:
        if (pblock->pb_mr != NULL) {
            (*(unsigned int *)value) = pblock->pb_mr->filter_reusable;
        } else {
            (*(unsigned int *)value) = 0;
        }
        break;
    case SLAPI_PLUGIN_MR_QUERY_OPERATOR:
        if (pblock->pb_mr != NULL) {
            (*(int *)value) = pblock->pb_mr->query_operator;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_PLUGIN_MR_USAGE:
        if (pblock->pb_mr != NULL) {
            (*(unsigned int *)value) = pblock->pb_mr->usage;
        } else {
            (*(unsigned int *)value) = 0;
        }
        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);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_ava;
        break;
    case SLAPI_PLUGIN_MR_FILTER_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_mr_filter_sub;
        break;
    case SLAPI_PLUGIN_MR_VALUES2KEYS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_mr_values2keys;
        break;
    case SLAPI_PLUGIN_MR_ASSERTION2KEYS_AVA:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_mr_assertion2keys_ava;
        break;
    case SLAPI_PLUGIN_MR_ASSERTION2KEYS_SUB:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_mr_assertion2keys_sub;
        break;
    case SLAPI_PLUGIN_MR_FLAGS:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(int *)value) = pblock->pb_plugin->plg_mr_flags;
        break;
    case SLAPI_PLUGIN_MR_NAMES:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(char ***)value) = pblock->pb_plugin->plg_mr_names;
        break;
    case SLAPI_PLUGIN_MR_COMPARE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(IFP *)value) = pblock->pb_plugin->plg_mr_compare;
        break;
    case SLAPI_PLUGIN_MR_NORMALIZE:
        if (pblock->pb_plugin->plg_type != SLAPI_PLUGIN_MATCHINGRULE) {
            return (-1);
        }
        (*(VFPV *)value) = pblock->pb_plugin->plg_mr_normalize;
        break;

    /* seq arguments */
    case SLAPI_SEQ_TYPE:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->seq_type;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_SEQ_ATTRNAME:
        if (pblock->pb_task != NULL) {
            (*(char **)value) = pblock->pb_task->seq_attrname;
        } else {
            (*(char **)value) = NULL;
        }
        break;
    case SLAPI_SEQ_VAL:
        if (pblock->pb_task != NULL) {
            (*(char **)value) = pblock->pb_task->seq_val;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    /* ldif2db arguments */
    case SLAPI_LDIF2DB_FILE:
        if (pblock->pb_task != NULL) {
            (*(char ***)value) = pblock->pb_task->ldif_files;
        } else {
            (*(char ***)value) = NULL;
        }
        break;
    case SLAPI_LDIF2DB_REMOVEDUPVALS:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->removedupvals;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_DB2INDEX_ATTRS:
        if (pblock->pb_task != NULL) {
            (*(char ***)value) = pblock->pb_task->db2index_attrs;
        } else {
            (*(char ***)value) = NULL;
        }
        break;
    case SLAPI_LDIF2DB_NOATTRINDEXES:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->ldif2db_noattrindexes;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_LDIF2DB_INCLUDE:
        if (pblock->pb_task != NULL) {
            (*(char ***)value) = pblock->pb_task->ldif_include;
        } else {
            (*(char ***)value) = NULL;
        }
        break;
    case SLAPI_LDIF2DB_EXCLUDE:
        if (pblock->pb_task != NULL) {
            (*(char ***)value) = pblock->pb_task->ldif_exclude;
        } else {
            (*(char ***)value) = NULL;
        }
        break;
    case SLAPI_LDIF2DB_GENERATE_UNIQUEID:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->ldif_generate_uniqueid;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_LDIF2DB_ENCRYPT:
    case SLAPI_DB2LDIF_DECRYPT:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->ldif_encrypt;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_LDIF2DB_NAMESPACEID:
        if (pblock->pb_task != NULL) {
            (*(char **)value) = pblock->pb_task->ldif_namespaceid;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    /* db2ldif arguments */
    case SLAPI_DB2LDIF_PRINTKEY:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->ldif_printkey;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_DB2LDIF_DUMP_UNIQUEID:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->ldif_dump_uniqueid;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_DB2LDIF_FILE:
        if (pblock->pb_task != NULL) {
            (*(char **)value) = pblock->pb_task->ldif_file;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    /* db2ldif/ldif2db/db2bak/bak2db arguments */
    case SLAPI_BACKEND_INSTANCE_NAME:
        if (pblock->pb_task != NULL) {
            (*(char **)value) = pblock->pb_task->instance_name;
        } else {
            (*(char **)value) = NULL;
        }
        break;
    case SLAPI_BACKEND_TASK:
        if (pblock->pb_task != NULL) {
            (*(Slapi_Task **)value) = pblock->pb_task->task;
        } else {
            (*(Slapi_Task **)value) = NULL;
        }
        break;
    case SLAPI_TASK_FLAGS:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->task_flags;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_DB2LDIF_SERVER_RUNNING:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->server_running;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_BULK_IMPORT_ENTRY:
        if (pblock->pb_task != NULL) {
            (*(Slapi_Entry **)value) = pblock->pb_task->import_entry;
        } else {
            (*(Slapi_Entry **)value) = NULL;
        }
        break;
    case SLAPI_BULK_IMPORT_STATE:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->import_state;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_LDIF_CHANGELOG:
        if (pblock->pb_task != NULL) {
            (*(int *)value) = pblock->pb_task->ldif_include_changelog;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* dbverify */
    case SLAPI_DBVERIFY_DBDIR:
        if (pblock->pb_task != NULL) {
            (*(char **)value) = pblock->pb_task->dbverify_dbdir;
        } else {
            (*(char **)value) = NULL;
        }
        break;


    /* transaction arguments */
    case SLAPI_PARENT_TXN:
        if (pblock->pb_deprecated != NULL) {
            (*(void **)value) = pblock->pb_deprecated->pb_parent_txn;
        } else {
            (*(void **)value) = NULL;
        }
        break;
    case SLAPI_TXN:
        if (pblock->pb_intop != NULL) {
            (*(void **)value) = pblock->pb_intop->pb_txn;
        } else {
            (*(void **)value) = NULL;
        }
        break;
    case SLAPI_TXN_RUV_MODS_FN:
        if (pblock->pb_intop != NULL) {
            (*(IFP *)value) = pblock->pb_intop->pb_txn_ruv_mods_fn;
        } else {
            (*(IFP *)value) = NULL;
        }
        break;

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

    case SLAPI_RESULT_CODE:
        if (pblock->pb_op != NULL)
            *((int *)value) = pblock->pb_op->o_results.result_code;
        break;
    case SLAPI_RESULT_MATCHED:
        if (pblock->pb_op != NULL)
            *((char **)value) = pblock->pb_op->o_results.result_matched;
        break;
    case SLAPI_RESULT_TEXT:
        if (pblock->pb_op != NULL)
            *((char **)value) = pblock->pb_op->o_results.result_text;
        break;
    case SLAPI_PB_RESULT_TEXT:
        if (pblock->pb_intop != NULL) {
            *((char **)value) = pblock->pb_intop->pb_result_text;
        } else {
            *((char **)value) = NULL;
        }
        break;

    /* Size of the database, in kb */
    case SLAPI_DBSIZE:
        if (pblock->pb_misc != NULL) {
            (*(unsigned int *)value) = pblock->pb_misc->pb_dbsize;
        } else {
            (*(unsigned int *)value) = 0;
        }
        break;

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

    case SLAPI_REQUESTOR_DN:
        /* NOTE: It's not a copy of the DN */
        if (pblock->pb_op != NULL) {
            char *dn = (char *)slapi_sdn_get_dn(&pblock->pb_op->o_sdn);
            if (dn == NULL)
                (*(char **)value) = "";
            else
                (*(char **)value) = dn;
        }
        break;

    case SLAPI_REQUESTOR_SDN:
        if (pblock->pb_op != NULL) {
            (*(Slapi_DN **)value) = &pblock->pb_op->o_sdn;
        }
        break;

    case SLAPI_REQUESTOR_NDN:
        /* NOTE: It's not a copy of the DN */
        if (pblock->pb_op != NULL) {
            char *ndn = (char *)slapi_sdn_get_ndn(&pblock->pb_op->o_sdn);
            if (ndn == NULL)
                (*(char **)value) = "";
            else
                (*(char **)value) = ndn;
        }
        break;

    case SLAPI_OPERATION_AUTHTYPE:
        if (pblock->pb_op != NULL) {
            if (pblock->pb_op->o_authtype == NULL)
                (*(char **)value) = "";
            else
                (*(char **)value) = pblock->pb_op->o_authtype;
        }
        break;

    case SLAPI_OPERATION_SSF:
        if (pblock->pb_op != NULL) {
            *((int *)value) = pblock->pb_op->o_ssf;
        }
        break;

    case SLAPI_CLIENT_DNS:
        if (pblock->pb_conn == NULL) {
            slapi_log_err(SLAPI_LOG_ERR,
                          "slapi_pblock_get", "Connection is NULL and hence cannot access SLAPI_CLIENT_DNS \n");
            return (-1);
        }
        (*(struct berval ***)value) = pblock->pb_conn->c_domain;
        break;

    case SLAPI_BE_MAXNESTLEVEL:
        if (NULL == be) {
            return (-1);
        }
        (*(int *)value) = be->be_maxnestlevel;
        break;
    case SLAPI_OPERATION_ID:
        if (pblock->pb_op != NULL) {
            (*(int *)value) = pblock->pb_op->o_opid;
        }
        break;
    /* Command line arguments */
    case SLAPI_ARGC:
        if (pblock->pb_misc != NULL) {
            (*(int *)value) = pblock->pb_misc->pb_slapd_argc;
        } else {
            (*(int *)value) = 0;
        }
        break;
    case SLAPI_ARGV:
        if (pblock->pb_misc != NULL) {
            (*(char ***)value) = pblock->pb_misc->pb_slapd_argv;
        } else {
            (*(char ***)value) = NULL;
        }
        break;

    /* Config file directory */
    case SLAPI_CONFIG_DIRECTORY:
        if (pblock->pb_intplugin != NULL) {
            (*(char **)value) = pblock->pb_intplugin->pb_slapd_configdir;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    /* password storage scheme (kexcoff */
    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_NAME:
        (*(char **)value) = pblock->pb_plugin->plg_pwdstorageschemename;
        break;
    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_USER_PWD:
        if (pblock->pb_deprecated != NULL) {
            (*(char **)value) = pblock->pb_deprecated->pb_pwd_storage_scheme_user_passwd;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_DB_PWD:
        if (pblock->pb_deprecated != NULL) {
            (*(char **)value) = pblock->pb_deprecated->pb_pwd_storage_scheme_db_passwd;
        } else {
            (*(char **)value) = NULL;
        }
        break;

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

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

    case SLAPI_PLUGIN_PWD_STORAGE_SCHEME_CMP_FN:
        (*(IFP *)value) = pblock->pb_plugin->plg_pwdstorageschemecmp;
        break;

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

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

    case SLAPI_PLUGIN_ENABLED:
        if (pblock->pb_intplugin != NULL) {
            *((int *)value) = pblock->pb_intplugin->pb_plugin_enabled;
        } else {
            *((int *)value) = 0;
        }
        break;

    /* DSE add parameters */
    case SLAPI_DSE_DONT_WRITE_WHEN_ADDING:
        if (pblock->pb_dse != NULL) {
            (*(int *)value) = pblock->pb_dse->dont_add_write;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* DSE add parameters */
    case SLAPI_DSE_MERGE_WHEN_ADDING:
        if (pblock->pb_dse != NULL) {
            (*(int *)value) = pblock->pb_dse->add_merge;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* DSE add parameters */
    case SLAPI_DSE_DONT_CHECK_DUPS:
        if (pblock->pb_dse != NULL) {
            (*(int *)value) = pblock->pb_dse->dont_check_dups;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* DSE modify parameters */
    case SLAPI_DSE_REAPPLY_MODS:
        if (pblock->pb_dse != NULL) {
            (*(int *)value) = pblock->pb_dse->reapply_mods;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* DSE read parameters */
    case SLAPI_DSE_IS_PRIMARY_FILE:
        if (pblock->pb_dse != NULL) {
            (*(int *)value) = pblock->pb_dse->is_primary_file;
        } else {
            (*(int *)value) = 0;
        }
        break;

    /* used internally by schema code (schema.c) */
    case SLAPI_SCHEMA_FLAGS:
        if (pblock->pb_dse != NULL) {
            (*(int *)value) = pblock->pb_dse->schema_flags;
        } else {
            (*(int *)value) = 0;
        }
        break;

    case SLAPI_URP_NAMING_COLLISION_DN:
        if (pblock->pb_intop != NULL) {
            (*(char **)value) = pblock->pb_intop->pb_urp_naming_collision_dn;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    case SLAPI_URP_TOMBSTONE_UNIQUEID:
        if (pblock->pb_intop != NULL) {
            (*(char **)value) = pblock->pb_intop->pb_urp_tombstone_uniqueid;
        } else {
            (*(char **)value) = NULL;
        }
        break;

    case SLAPI_URP_TOMBSTONE_CONFLICT_DN:
        if (pblock->pb_intop != NULL) {
            (*(char **)value) = pblock->pb_intop->pb_urp_tombstone_conflict_dn;
        } else {
            (*(char **)value) = NULL;
        }
	break;

    case SLAPI_SEARCH_CTRLS:
        if (pblock->pb_intop != NULL) {
            (*(LDAPControl ***)value) = pblock->pb_intop->pb_search_ctrls;
        } else {
            (*(LDAPControl ***)value) = NULL;
        }
        break;

    case SLAPI_PLUGIN_SYNTAX_FILTER_NORMALIZED:
        if (pblock->pb_intplugin != NULL) {
            (*(int *)value) = pblock->pb_intplugin->pb_syntax_filter_normalized;
        } else {
            (*(int *)value) =  0;
        }
        break;

    case SLAPI_PLUGIN_SYNTAX_FILTER_DATA:
        if (pblock->pb_intplugin != NULL) {
            (*(void **)value) = pblock->pb_intplugin->pb_syntax_filter_data;
        } else {
            (*(void **)value) = NULL;
        }
        break;

    case SLAPI_PAGED_RESULTS_INDEX:
        if (op_is_pagedresults(pblock->pb_op) && pblock->pb_intop != NULL) {
            /* search req is simple paged results */
            (*(int *)value) = pblock->pb_intop->pb_paged_results_index;
        } else {
            (*(int *)value) = -1;
        }
        break;

    case SLAPI_PAGED_RESULTS_COOKIE:
        if (op_is_pagedresults(pblock->pb_op) && pblock->pb_intop != NULL) {
            /* search req is simple paged results */
            (*(int *)value) = pblock->pb_intop->pb_paged_results_cookie;
        } else {
            (*(int *)value) = 0;
        }
        break;

    case SLAPI_USN_INCREMENT_FOR_TOMBSTONE:
        if (pblock->pb_intop != NULL) {
            (*(int32_t *)value) = pblock->pb_intop->pb_usn_tombstone_incremented;
        } else {
            (*(int32_t *)value) = 0;
        }
        break;

    /* ACI Target Check */
    case SLAPI_ACI_TARGET_CHECK:
        if (pblock->pb_misc != NULL) {
            (*(int *)value) = pblock->pb_misc->pb_aci_target_check;
        } else {
            (*(int *)value) = 0;
        }
        break;

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

    return (0);
}