本文整理汇总了C++中slapi_pblock_set函数的典型用法代码示例。如果您正苦于以下问题:C++ slapi_pblock_set函数的具体用法?C++ slapi_pblock_set怎么用?C++ slapi_pblock_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slapi_pblock_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: oath_preop_init
int oath_preop_init(Slapi_PBlock *pb) {
int rc;
slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &oath_preop_plugin_id);
if (slapi_pblock_get(pb, SLAPI_PLUGIN_ARGC, (void *) &argc) != 0 ||
slapi_pblock_get(pb, SLAPI_PLUGIN_ARGV, (void *) &argv)) {
slapi_log_error(SLAPI_LOG_PLUGIN, "oath", "oath_preop_init: Failed to obtain plugin args, not registering plugin\n");
return -1;
}
if (argc < 1) {
slapi_log_error(SLAPI_LOG_PLUGIN, "oath", "oath_preop_init: No configuration given, not registering plugin\n");
return -1;
}
if (slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_03) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION, (void *) &oath_preop_plugin_desc) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_BIND_FN, (void *) oath_preop_bind) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN, (void *) oath_preop_start) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN, (void *) oath_preop_close) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, "oath",
"oath_preop_init: Error registering plugin\n");
return -1;
}
slapi_log_error(SLAPI_LOG_PLUGIN, "oath", "oath_preop_init: Plugin successfully registered\n");
return 0;
}
示例2: mr_wrap_mr_index_sv_fn
/* this function takes SLAPI_PLUGIN_MR_VALUES as Slapi_Value ** and
returns SLAPI_PLUGIN_MR_KEYS as Slapi_Value **
*/
static int
mr_wrap_mr_index_sv_fn(Slapi_PBlock* pb)
{
int rc = -1;
Slapi_Value **in_vals = NULL;
Slapi_Value **out_vals = NULL;
struct slapdplugin *pi = NULL;
slapi_pblock_set(pb, SLAPI_PLUGIN_MR_KEYS, out_vals); /* make sure output is cleared */
slapi_pblock_get(pb, SLAPI_PLUGIN, &pi);
if (!pi) {
slapi_log_err(SLAPI_LOG_ERR, "mr_wrap_mr_index_sv_fn", "No plugin specified\n");
} else if (!pi->plg_mr_values2keys) {
slapi_log_err(SLAPI_LOG_ERR, "mr_wrap_mr_index_sv_fn", "Plugin has no plg_mr_values2keys function\n");
} else {
struct mr_private *mrpriv = NULL;
int ftype = plugin_mr_get_type(pi);
slapi_pblock_get(pb, SLAPI_PLUGIN_MR_VALUES, &in_vals);
(*pi->plg_mr_values2keys)(pb, in_vals, &out_vals, ftype);
slapi_pblock_set(pb, SLAPI_PLUGIN_MR_KEYS, out_vals);
/* we have to save out_vals to free next time or during destroy */
slapi_pblock_get(pb, SLAPI_PLUGIN_OBJECT, &mrpriv);
/* In case SLAPI_PLUGIN_OBJECT is not set
* (e.g. custom index/filter create function did not initialize it
*/
if (mrpriv) {
mr_private_indexer_done(mrpriv); /* free old vals, if any */
mrpriv->sva = out_vals; /* save pointer for later */
}
rc = 0;
}
return rc;
}
示例3: acct_postop_init
int
acct_postop_init( Slapi_PBlock *pb )
{
void *plugin_id = get_identity();
if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
SLAPI_PLUGIN_VERSION_01 ) != 0 ||
slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
(void *)&post_plugin_desc ) != 0 ) {
slapi_log_err(SLAPI_LOG_ERR, POST_PLUGIN_NAME,
"acct_postop_init - Failed to set plugin version or name\n" );
return( CALLBACK_ERR );
}
if ( slapi_pblock_set( pb, SLAPI_PLUGIN_POST_BIND_FN, (void *)acct_bind_postop ) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN, (void *) acct_post_op) != 0 ||
slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN, (void *) acct_post_op) != 0)
{
slapi_log_err(SLAPI_LOG_ERR, POST_PLUGIN_NAME,
"acct_postop_init - Failed to set plugin callback function\n" );
return( CALLBACK_ERR );
}
if( slapi_pblock_get( pb, SLAPI_PLUGIN_IDENTITY, &plugin_id ) != 0 ) {
slapi_log_err(SLAPI_LOG_ERR, POST_PLUGIN_NAME,
"acct_postop_init - Failed to get plugin identity\n" );
return( CALLBACK_ERR );
}
return( CALLBACK_OK );
}
示例4: usn_bepostop_init
static int
usn_bepostop_init(Slapi_PBlock *pb)
{
int rc = 0;
Slapi_Entry *plugin_entry = NULL;
char *plugin_type = NULL;
int postadd = SLAPI_PLUGIN_BE_POST_ADD_FN;
int postmod = SLAPI_PLUGIN_BE_POST_MODIFY_FN;
int postmdn = SLAPI_PLUGIN_BE_POST_MODRDN_FN;
int postdel = SLAPI_PLUGIN_BE_POST_DELETE_FN;
if ((slapi_pblock_get(pb, SLAPI_PLUGIN_CONFIG_ENTRY, &plugin_entry) == 0) &&
plugin_entry &&
(plugin_type = slapi_entry_attr_get_charptr(plugin_entry,
"nsslapd-plugintype")) &&
plugin_type && strstr(plugin_type, "betxn")) {
postadd = SLAPI_PLUGIN_BE_TXN_POST_ADD_FN;
postmod = SLAPI_PLUGIN_BE_TXN_POST_MODIFY_FN;
postmdn = SLAPI_PLUGIN_BE_TXN_POST_MODRDN_FN;
postdel = SLAPI_PLUGIN_BE_TXN_POST_DELETE_FN;
}
slapi_ch_free_string(&plugin_type);
if ((slapi_pblock_set(pb, postadd, (void *)usn_bepostop) != 0) ||
(slapi_pblock_set(pb, postdel, (void *)usn_bepostop_delete) != 0) ||
(slapi_pblock_set(pb, postmod, (void *)usn_bepostop_modify) != 0) ||
(slapi_pblock_set(pb, postmdn, (void *)usn_bepostop) != 0)) {
slapi_log_error(SLAPI_LOG_FATAL, USN_PLUGIN_SUBSYSTEM,
"usn_bepostop_init: failed to register bepostop plugin\n");
rc = -1;
}
return rc;
}
示例5: sidgen_task_init
int sidgen_task_init(Slapi_PBlock *pb)
{
int ret = 0;
ret = slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY,
&global_sidgen_plugin_id);
if (ret != 0 || global_sidgen_plugin_id == NULL) {
LOG_FATAL("Plugin identity not available.\n");
ret = (ret != 0) ? ret : EINVAL;
goto done;
}
ret = slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION,
(void *) SLAPI_PLUGIN_VERSION_03);
ret |= slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN,
(void *) sigden_task_start);
done:
if (ret != 0) {
LOG_FATAL("Failed to initialize plug-in\n" );
}
return ret;
}
示例6: be_unbindall
void
be_unbindall(Connection *conn, Operation *op)
{
int i;
Slapi_PBlock pb = {0};
for ( i = 0; i < maxbackends; i++ )
{
if ( backends[i] && (backends[i]->be_unbind != NULL) )
{
/* This is the modern, and faster way to do pb memset(0)
* It also doesn't trigger the HORRIBLE stack overflows I found ...
*/
pblock_init_common( &pb, backends[i], conn, op );
if ( plugin_call_plugins( &pb, SLAPI_PLUGIN_PRE_UNBIND_FN ) == 0 )
{
int rc = 0;
slapi_pblock_set( &pb, SLAPI_PLUGIN, backends[i]->be_database );
if(backends[i]->be_state != BE_STATE_DELETED &&
backends[i]->be_unbind!=NULL)
{
rc = (*backends[i]->be_unbind)( &pb );
}
slapi_pblock_set( &pb, SLAPI_PLUGIN_OPRETURN, &rc );
(void) plugin_call_plugins( &pb, SLAPI_PLUGIN_POST_UNBIND_FN );
}
}
}
}
示例7: slapi_delete_internal_set_pb
/* Initialize a pblock for a call to slapi_delete_internal_pb() */
void
slapi_delete_internal_set_pb (Slapi_PBlock *pb,
const char *rawdn,
LDAPControl **controls, const char *uniqueid,
Slapi_ComponentId *plugin_identity,
int operation_flags)
{
Operation *op;
PR_ASSERT (pb != NULL);
if (pb == NULL || rawdn == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, NULL,
"slapi_delete_internal_set_pb: NULL parameter\n");
return;
}
op = internal_operation_new(SLAPI_OPERATION_DELETE,operation_flags);
slapi_pblock_set(pb, SLAPI_OPERATION, op);
slapi_pblock_set(pb, SLAPI_ORIGINAL_TARGET, (void*)rawdn);
slapi_pblock_set(pb, SLAPI_CONTROLS_ARG, controls);
if (uniqueid)
{
slapi_pblock_set(pb, SLAPI_TARGET_UNIQUEID, (void*)uniqueid);
}
slapi_pblock_set(pb, SLAPI_PLUGIN_IDENTITY, plugin_identity);
}
示例8: passthruauth_init
/*
* Plugin initialization function (which must be listed in the appropriate
* slapd config file).
*/
int
passthruauth_init( Slapi_PBlock *pb )
{
PASSTHRU_ASSERT( pb != NULL );
slapi_log_error( SLAPI_LOG_PLUGIN, PASSTHRU_PLUGIN_SUBSYSTEM,
"=> passthruauth_init\n" );
if ( slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION,
(void *)SLAPI_PLUGIN_VERSION_01 ) != 0
|| slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION,
(void *)&pdesc ) != 0
|| slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN,
(void *)passthru_bindpreop_start ) != 0
|| slapi_pblock_set( pb, SLAPI_PLUGIN_PRE_BIND_FN,
(void *)passthru_bindpreop ) != 0
|| slapi_pblock_set( pb, SLAPI_PLUGIN_CLOSE_FN,
(void *)passthru_bindpreop_close ) != 0 ) {
slapi_log_error( SLAPI_LOG_FATAL, PASSTHRU_PLUGIN_SUBSYSTEM,
"passthruauth_init failed\n" );
return( -1 );
}
slapi_log_error( SLAPI_LOG_PLUGIN, PASSTHRU_PLUGIN_SUBSYSTEM,
"<= passthruauth_init succeeded\n" );
return( 0 );
}
示例9: bitwise_filter_create
static int
bitwise_filter_create (Slapi_PBlock* pb)
{
auto int rc = LDAP_UNAVAILABLE_CRITICAL_EXTENSION; /* failed to initialize */
auto char* mrOID = NULL;
auto char* mrTYPE = NULL;
auto struct berval* mrVALUE = NULL;
if (!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_OID, &mrOID) && mrOID != NULL &&
!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_TYPE, &mrTYPE) && mrTYPE != NULL &&
!slapi_pblock_get (pb, SLAPI_PLUGIN_MR_VALUE, &mrVALUE) && mrVALUE != NULL) {
struct bitwise_match_cb *bmc = NULL;
if (strcmp(mrOID, "1.2.840.113556.1.4.803") == 0) {
slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_and);
} else if (strcmp(mrOID, "1.2.840.113556.1.4.804") == 0) {
slapi_pblock_set (pb, SLAPI_PLUGIN_MR_FILTER_MATCH_FN, (void*)bitwise_filter_match_or);
} else { /* this oid not handled by this plugin */
LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create OID (%s) not handled\n", mrOID, 0, 0);
return rc;
}
bmc = new_bitwise_match_cb(mrTYPE, mrVALUE);
slapi_pblock_set (pb, SLAPI_PLUGIN_OBJECT, bmc);
slapi_pblock_set (pb, SLAPI_PLUGIN_DESTROY_FN, (void*)bitwise_filter_destroy);
rc = LDAP_SUCCESS;
} else {
LDAPDebug (LDAP_DEBUG_FILTER, "=> bitwise_filter_create missing parameter(s)\n", 0, 0, 0);
}
LDAPDebug (LDAP_DEBUG_FILTER, "<= bitwise_filter_create %i\n", rc, 0, 0);
return LDAP_SUCCESS;
}
示例10: ipa_topo_pre_add
int ipa_topo_pre_add(Slapi_PBlock *pb)
{
int result = SLAPI_PLUGIN_SUCCESS;
char *errtxt = NULL;
slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
"--> ipa_topo_pre_add\n");
if (0 == ipa_topo_get_plugin_active()) {
slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
"<-- ipa_topo_pre_add - plugin not active\n");
return 0;
}
if (ipa_topo_pre_ignore_op(pb)) return result;
if (ipa_topo_is_entry_managed(pb)) {
int rc = LDAP_UNWILLING_TO_PERFORM;
errtxt = slapi_ch_smprintf("Entry is managed by topology plugin."
" Adding of entry not allowed.\n");
slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errtxt);
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc);
result = SLAPI_PLUGIN_FAILURE;
} else if (ipa_topo_check_segment_is_valid(pb, &errtxt)) {
int rc = LDAP_UNWILLING_TO_PERFORM;
slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errtxt);
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc);
result = SLAPI_PLUGIN_FAILURE;
}
slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
"<-- ipa_topo_pre_add\n");
return result;
}
示例11: replication_legacy_plugin_init
/* Initialize the legacy replication plugin */
int
replication_legacy_plugin_init(Slapi_PBlock *pb)
{
static int legacy_initialised= 0;
int rc= 0; /* OK */
void *identity = NULL;
slapi_pblock_get (pb, SLAPI_PLUGIN_IDENTITY, &identity);
PR_ASSERT (identity);
repl_set_plugin_identity (PLUGIN_LEGACY_REPLICATION, identity);
if(rc==0 && !legacy_initialised)
{
rc= slapi_pblock_set( pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_01 );
rc= slapi_pblock_set( pb, SLAPI_PLUGIN_DESCRIPTION, (void *)&legacydesc );
rc= slapi_pblock_set( pb, SLAPI_PLUGIN_START_FN, (void *) legacy_start );
rc= slapi_pblock_set( pb, SLAPI_PLUGIN_CLOSE_FN, (void *) legacy_stop );
rc= slapi_pblock_set( pb, SLAPI_PLUGIN_POSTSTART_FN, (void *) legacy_poststart );
/* Register the plugin interfaces we implement */
rc= slapi_register_plugin("preoperation", 1 /* Enabled */, "legacy_preop_init", legacy_preop_init, "Legacy replication preoperation plugin", NULL, identity);
rc= slapi_register_plugin("postoperation", 1 /* Enabled */, "legacy_postop_init", legacy_postop_init, "Legacy replication postoperation plugin", NULL, identity);
rc= slapi_register_plugin("internalpreoperation", 1 /* Enabled */, "legacy_internalpreop_init", legacy_internalpreop_init, "Legacy replication internal preoperation plugin", NULL, identity);
rc= slapi_register_plugin("internalpostoperation", 1 /* Enabled */, "legacy_internalpostop_init", legacy_internalpostop_init, "Legacy replication internal postoperation plugin", NULL, identity);
rc= slapi_register_plugin("entry", 1 /* Enabled */, "legacy_entry_init", legacy_entry_init, "Legacy replication entry plugin", NULL, identity);
legacy_initialised= 1;
}
return rc;
}
示例12: ipa_topo_pre_modrdn
int
ipa_topo_pre_modrdn(Slapi_PBlock *pb)
{
int result = SLAPI_PLUGIN_SUCCESS;
slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
"--> ipa_topo_pre_modrdn\n");
if (0 == ipa_topo_get_plugin_active()) {
slapi_log_error(SLAPI_LOG_PLUGIN, IPA_TOPO_PLUGIN_SUBSYSTEM,
"<-- ipa_topo_pre_modrdn - plugin not active\n");
return 0;
}
if (ipa_topo_pre_ignore_op(pb)) return result;
if (ipa_topo_check_entry_move(pb)){
int rc = LDAP_UNWILLING_TO_PERFORM;
char *errtxt;
errtxt = slapi_ch_smprintf("Moving of a segment or config entry "
"to another subtree is not allowed.\n");
slapi_pblock_set(pb, SLAPI_PB_RESULT_TEXT, errtxt);
slapi_pblock_set(pb, SLAPI_RESULT_CODE, &rc);
result = SLAPI_PLUGIN_FAILURE;
}
return result;
}
示例13: rename_internal_pb
static int rename_internal_pb (Slapi_PBlock *pb)
{
LDAPControl **controls;
Operation *op;
int opresult = 0;
PR_ASSERT (pb != NULL);
slapi_pblock_get(pb, SLAPI_CONTROLS_ARG, &controls);
slapi_pblock_get(pb, SLAPI_OPERATION, &op);
op->o_handler_data = &opresult;
op->o_result_handler = internal_getresult_callback;
slapi_pblock_set(pb, SLAPI_REQCONTROLS, controls);
/* set parameters common for all internal operations */
set_common_params (pb);
/* set actions taken to process the operation */
set_config_params (pb);
op_shared_rename (pb, 0 /* not passing ownership of args */ );
slapi_pblock_set(pb, SLAPI_PLUGIN_INTOP_RESULT, &opresult);
return 0;
}
示例14: slapi_rename_internal_set_pb_ext
void
slapi_rename_internal_set_pb_ext(Slapi_PBlock *pb,
const Slapi_DN *olddn,
const char *newrdn, /* normalized */
const Slapi_DN *newsuperior, int deloldrdn,
LDAPControl **controls, const char *uniqueid,
Slapi_ComponentId *plugin_identity,
int operation_flags)
{
Operation *op;
PR_ASSERT (pb != NULL);
if (pb == NULL || olddn == NULL || newrdn == NULL)
{
slapi_log_error(SLAPI_LOG_FATAL, NULL,
"slapi_rename_internal_set_pb: NULL parameter\n");
return;
}
op = internal_operation_new(SLAPI_OPERATION_MODRDN,operation_flags);
slapi_pblock_set(pb, SLAPI_OPERATION, op);
slapi_pblock_set(pb, SLAPI_ORIGINAL_TARGET,
(void*)slapi_sdn_get_dn(olddn));
slapi_pblock_set(pb, SLAPI_MODRDN_TARGET_SDN, (void*)olddn);
slapi_pblock_set(pb, SLAPI_MODRDN_NEWRDN, (void*)newrdn);
slapi_pblock_set(pb, SLAPI_MODRDN_NEWSUPERIOR_SDN, (void*)newsuperior);
slapi_pblock_set(pb, SLAPI_MODRDN_DELOLDRDN, &deloldrdn);
slapi_pblock_set(pb, SLAPI_CONTROLS_ARG, controls);
slapi_pblock_set(pb, SLAPI_MODIFY_MODS, NULL);
if (uniqueid)
{
slapi_pblock_set(pb, SLAPI_TARGET_UNIQUEID, (void*)uniqueid);
}
slapi_pblock_set(pb, SLAPI_PLUGIN_IDENTITY, plugin_identity);
}
示例15: ipa_topo_internal_postop_init
static int
ipa_topo_internal_postop_init(Slapi_PBlock *pb)
{
int rc;
rc = slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_ADD_FN,
(void *)ipa_topo_post_add);
rc |= slapi_pblock_set(pb, SLAPI_PLUGIN_INTERNAL_POST_DELETE_FN,
(void *)ipa_topo_post_del);
return(rc);
}