From: Luke Howard Date: Thu, 21 Jul 2005 18:07:16 +0000 (+0000) Subject: remove SLAPI cruft X-Git-Tag: OPENLDAP_AC_BP~289 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=001754eb656a0d8d2100fa58d91da5e8e1ae0ce7;p=openldap remove SLAPI cruft --- diff --git a/servers/slapd/slapi/plugin.c b/servers/slapd/slapi/plugin.c index 200c8ca429..7063c00f78 100644 --- a/servers/slapd/slapi/plugin.c +++ b/servers/slapd/slapi/plugin.c @@ -111,7 +111,7 @@ plugin_pblock_new( goto done; } - rc = slapi_int_load_plugin( pPlugin, path, initfunc, TRUE, NULL, &hdLoadHandle ); + rc = slapi_int_load_plugin( pPlugin, path, initfunc, 1, NULL, &hdLoadHandle ); if ( rc != 0 ) { goto done; } @@ -618,7 +618,7 @@ slapi_int_load_plugin( return LDAP_LOCAL_ERROR; } - if ( doInit == TRUE ) { + if ( doInit ) { rc = ( *fpInitFunc )( pPlugin ); if ( rc != LDAP_SUCCESS ) { lt_dlclose( *pLdHandle ); @@ -703,9 +703,9 @@ slapi_int_read_config( } /* automatically instantiate overlay if necessary */ - if ( !overlay_is_inst( be, "slapi" ) ) { - if ( overlay_config( be, "slapi" ) != 0 ) { - fprintf( stderr, "failed to instantiate SLAPI overlay\n"); + if ( !overlay_is_inst( be, SLAPI_OVERLAY_NAME ) ) { + if ( overlay_config( be, SLAPI_OVERLAY_NAME ) != 0 ) { + fprintf( stderr, "Failed to instantiate SLAPI overlay\n"); return -1; } } diff --git a/servers/slapd/slapi/slapi.h b/servers/slapd/slapi/slapi.h index fd3ddc8bd8..73b70e3a91 100644 --- a/servers/slapd/slapi/slapi.h +++ b/servers/slapd/slapi/slapi.h @@ -48,20 +48,13 @@ LDAP_BEGIN_DECL * Was: slapi_common.h */ -/* a little naif ... */ -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - /* * Was: slapi_utils.h */ typedef struct _Audit_record Audit_record; +#define SLAPI_OVERLAY_NAME "slapi" + #define SLAPI_CONTROL_MANAGEDSAIT_OID LDAP_CONTROL_MANAGEDSAIT #define SLAPI_CONTROL_SORTEDSEARCH_OID LDAP_CONTROL_SORTREQUEST #define SLAPI_CONTROL_PAGED_RESULTS_OID LDAP_CONTROL_PAGEDRESULTS @@ -134,51 +127,6 @@ struct slapi_pblock { #define SLAPI_PLUGIN_IS_POST_FN(x) ((x) >= SLAPI_PLUGIN_POST_BIND_FN && (x) <= SLAPI_PLUGIN_POST_RESULT_FN) -/* - * Was: slapi_cl.h - */ - -#if 0 -#define TIME_SIZE 20 -#define OBJECTCLASS "objectclass" -#define TOP "top" -#define CHANGE_TIME "changetime" -#define CHANGE_TYPE "changetype" -#define CHANGE_TARGETDN "targetdn" -#define CHANGES "changes" -#define CHANGE_NUMBER "changenumber" -/* - * FIXME: I get complaints like "ADD" being redefined - first definition - * being in "/usr/include/arpa/nameser.h:552" - */ -#undef ADD -#define ADD "add: " -#define ADDLEN 5 -#define DEL "delete: " -#define DELLEN 8 -#define REPLACE "replace: " -#define REPLEN 9 -#define MOD "modify" -#define MODRDN "modrdn" -#define CHANGE_LOGENTRY "changelogentry" -#define IBM_CHANGE_LOGENTRY "ibm-changelog" -#define CL_NEWRDN "newrdn" -#define CL_DELRDN "deleteoldrdn" -#define CHANGE_INITIATOR "ibm-changeInitiatorsName" - -extern void slapi_register_changelog_suffix(char *suffix); -extern char **slapi_get_changelog_suffixes(); -extern void slapi_update_changelog_counters(long curNum, long numEntries); -extern char *slapi_get_cl_firstNum(); -extern char *slapi_get_cl_lastNum(); -extern int slapi_add_to_changelog(Slapi_Entry *ent, char *suffix, char *chNum, Operation* op); -extern int slapi_delete_changelog(char *dn, char *suffix, char *chNum, Operation* op); -extern int slapi_modify_changelog(char *dn,LDAPMod *mods,char *suffix, char *chNum, Operation* op); -extern int slapi_modifyrdn_changelog(char *olddn, char *newRdn, int delRdn, char *suffix, char *chNum, Operation* op); -extern Backend * slapi_cl_get_be(char *dn); -#endif - - /* * Attribute flags returned by slapi_attr_get_flags() */ diff --git a/servers/slapd/slapi/slapi_overlay.c b/servers/slapd/slapi/slapi_overlay.c index 4b06bfb74e..03b359b51d 100644 --- a/servers/slapd/slapi/slapi_overlay.c +++ b/servers/slapd/slapi/slapi_overlay.c @@ -808,7 +808,6 @@ slapi_over_access_allowed( return rc; } -#if 0 static int slapi_over_acl_group( Operation *op, @@ -818,12 +817,46 @@ slapi_over_acl_group( ObjectClass *group_oc, AttributeDescription *group_at ) { - slapi_pblock_set( op->o_pb, SLAPI_X_GROUP_ENTRY, (void *)e ); - slapi_pblock_set( op->o_pb, SLAPI_X_GROUP_OPERATION_DN, (void *)op_ndn->bv_val ); - slapi_pblock_set( op->o_pb, SLAPI_X_GROUP_ATTRIBUTE, (void *)group_at->ad_cname.bv_val ); - slapi_pblock_set( op->o_pb, SLAPI_X_GROUP_TARGET_ENTRY, (void *)target ); + Slapi_Entry *e; + int rc; + Slapi_PBlock *pb = op->o_pb; + + if ( pb == NULL ) { + return SLAP_CB_CONTINUE; + } + + rc = be_entry_get_rw( op, gr_ndn, group_oc, group_at, 0, &e ); + if ( e == NULL ) { + return SLAP_CB_CONTINUE; + } + + slapi_pblock_set( pb, SLAPI_X_GROUP_ENTRY, (void *)e ); + slapi_pblock_set( pb, SLAPI_X_GROUP_OPERATION_DN, (void *)op_ndn->bv_val ); + slapi_pblock_set( pb, SLAPI_X_GROUP_ATTRIBUTE, (void *)group_at->ad_cname.bv_val ); + slapi_pblock_set( pb, SLAPI_X_GROUP_TARGET_ENTRY, (void *)target ); + + rc = slapi_int_call_plugins( op->o_bd, SLAPI_X_PLUGIN_PRE_GROUP_FN, pb ); + if ( rc == 0 ) + rc = SLAP_CB_CONTINUE; + else + slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void **)&rc ); + + slapi_pblock_set( pb, SLAPI_X_GROUP_ENTRY, NULL ); + slapi_pblock_set( pb, SLAPI_X_GROUP_OPERATION_DN, NULL ); + slapi_pblock_set( pb, SLAPI_X_GROUP_ATTRIBUTE, NULL ); + slapi_pblock_set( pb, SLAPI_X_GROUP_TARGET_ENTRY, NULL ); + + if ( e != target ) + be_entry_release_r( op, e ); + + /* + * XXX don't call POST_GROUP_FN, I have no idea what the point of + * that plugin function was anyway + */ + return rc; } +#if 0 static int slapi_over_compute_output_attr_access(computed_attr_context *c, Slapi_Attr *a, Slapi_Entry *e) { @@ -855,7 +888,7 @@ slapi_int_overlay_init() { memset( &slapi, 0, sizeof(slapi) ); - slapi.on_bi.bi_type = "slapi"; + slapi.on_bi.bi_type = SLAPI_OVERLAY_NAME; slapi.on_bi.bi_op_bind = slapi_op_func; slapi.on_bi.bi_op_unbind = slapi_op_func; diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index 7eeb7d405c..0445a5e53a 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -445,7 +445,7 @@ slapi_pblock_new() pb = (Slapi_PBlock *) ch_malloc(sizeof(Slapi_PBlock)); if ( pb != NULL ) { - pb->ckParams = TRUE; + pb->ckParams = 1; ldap_pvt_thread_mutex_init( &pb->pblockMutex ); memset( pb->curParams, 0, sizeof(pb->curParams) ); memset( pb->curVals, 0, sizeof(pb->curVals) );