/* * memberof_config() * * Read configuration and create a configuration data structure. * This is called after the server has configured itself so we can * perform checks with regards to suffixes if it ever becomes * necessary. * Returns an LDAP error code (LDAP_SUCCESS if all goes well). */ int memberof_config(Slapi_Entry *config_e, Slapi_PBlock *pb) { int returncode = LDAP_SUCCESS; char returntext[SLAPI_DSE_RETURNTEXT_SIZE]; if ( inited ) { slapi_log_err(SLAPI_LOG_ERR, MEMBEROF_PLUGIN_SUBSYSTEM, "memberof_config - Only one memberOf plugin instance can be used\n" ); return( LDAP_PARAM_ERROR ); } /* initialize the RW lock to protect the main config */ memberof_config_lock = slapi_new_rwlock(); /* initialize fields */ if (SLAPI_DSE_CALLBACK_OK == memberof_validate_config(NULL, NULL, config_e, &returncode, returntext, NULL)) { memberof_apply_config(NULL, NULL, config_e, &returncode, returntext, NULL); } /* * config DSE must be initialized before we get here we only need the dse callbacks * for the plugin entry, but not the shared config entry. */ if (returncode == LDAP_SUCCESS) { const char *config_dn = slapi_sdn_get_dn(memberof_get_plugin_area()); slapi_config_register_callback_plugin(SLAPI_OPERATION_MODIFY, DSE_FLAG_PREOP | DSE_FLAG_PLUGIN, config_dn, LDAP_SCOPE_BASE, MEMBEROF_CONFIG_FILTER, memberof_validate_config, NULL,pb); slapi_config_register_callback_plugin(SLAPI_OPERATION_MODIFY, DSE_FLAG_POSTOP | DSE_FLAG_PLUGIN, config_dn, LDAP_SCOPE_BASE, MEMBEROF_CONFIG_FILTER, memberof_apply_config, NULL, pb); slapi_config_register_callback_plugin(SLAPI_OPERATION_MODRDN, DSE_FLAG_PREOP | DSE_FLAG_PLUGIN, config_dn, LDAP_SCOPE_BASE, MEMBEROF_CONFIG_FILTER, dont_allow_that, NULL, pb); slapi_config_register_callback_plugin(SLAPI_OPERATION_DELETE, DSE_FLAG_PREOP | DSE_FLAG_PLUGIN, config_dn, LDAP_SCOPE_BASE, MEMBEROF_CONFIG_FILTER, dont_allow_that, NULL, pb); slapi_config_register_callback_plugin(SLAPI_OPERATION_SEARCH, DSE_FLAG_PREOP | DSE_FLAG_PLUGIN, config_dn, LDAP_SCOPE_BASE, MEMBEROF_CONFIG_FILTER, memberof_search, NULL, pb); } inited = 1; if (returncode != LDAP_SUCCESS) { slapi_log_err(SLAPI_LOG_ERR, MEMBEROF_PLUGIN_SUBSYSTEM, "memberof_config - Error %d: %s\n", returncode, returntext); } return returncode; }
static int ipa_topo_rootdse_init(Slapi_PBlock *pb) { int rc = SLAPI_PLUGIN_FAILURE; if (slapi_config_register_callback_plugin(SLAPI_OPERATION_SEARCH, DSE_FLAG_PREOP | DSE_FLAG_PLUGIN, "", LDAP_SCOPE_BASE, "(objectclass=*)", ipa_topo_rootdse_search, NULL, pb)) { rc = SLAPI_PLUGIN_SUCCESS; } return rc; }