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;
}
return LDAP_LOCAL_ERROR;
}
- if ( doInit == TRUE ) {
+ if ( doInit ) {
rc = ( *fpInitFunc )( pPlugin );
if ( rc != LDAP_SUCCESS ) {
lt_dlclose( *pLdHandle );
}
/* 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;
}
}
* 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
#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()
*/
return rc;
}
-#if 0
static int
slapi_over_acl_group(
Operation *op,
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)
{
{
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;
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) );