goto done;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)type );
- if ( rc != 0 ) {
- goto done;
- }
-
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGC, (void *)argc );
- if ( rc != 0 ) {
- goto done;
- }
+ slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)&type );
+ slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGC, (void *)&argc );
av2 = ldap_charray_dup( argv );
if ( av2 == NULL ) {
} else {
ppPluginArgv = NULL;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGV, (void *)ppPluginArgv );
- if ( rc != 0 ) {
- goto done;
- }
- rc = slapi_pblock_set( pPlugin, SLAPI_X_CONFIG_ARGV, (void *)av2 );
- if ( rc != 0 ) {
- goto done;
- }
+ slapi_pblock_set( pPlugin, SLAPI_PLUGIN_ARGV, (void *)ppPluginArgv );
+ slapi_pblock_set( pPlugin, SLAPI_X_CONFIG_ARGV, (void *)av2 );
rc = slapi_int_load_plugin( pPlugin, path, initfunc, 1, NULL, &hdLoadHandle );
if ( rc != 0 ) {
#define PBLOCK_ERROR (-1)
#define PBLOCK_MAX_PARAMS 100
+union slapi_pblock_value {
+ int pv_integer;
+ long pv_long_integer;
+ void *pv_pointer;
+ void (*pv_function_pointer)(void *);
+};
+
struct slapi_pblock {
ldap_pvt_thread_mutex_t pblockMutex;
int numParams;
int curParams[PBLOCK_MAX_PARAMS];
- void *curVals[PBLOCK_MAX_PARAMS];
+ union slapi_pblock_value curVals[PBLOCK_MAX_PARAMS];
/* native types */
Connection *pconn;
Operation *pop;
tp[i] = NULL;
slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_SEARCH_ENTRIES, (void *)tp );
- slapi_pblock_set( pb, SLAPI_NENTRIES, (void *)i );
+ slapi_pblock_set( pb, SLAPI_NENTRIES, (void *)&i );
return LDAP_SUCCESS;
}
Slapi_ComponentId *plugin_identity,
int operation_flags )
{
+ int no_limit = SLAP_NO_LIMIT;
+ int deref = LDAP_DEREF_NEVER;
+
slapi_int_connection_init_pb( pb, LDAP_REQ_SEARCH );
slapi_pblock_set( pb, SLAPI_SEARCH_TARGET, (void *)base );
- slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)scope );
- slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, NULL );
+ slapi_pblock_set( pb, SLAPI_SEARCH_SCOPE, (void *)&scope );
+ slapi_pblock_set( pb, SLAPI_SEARCH_FILTER, (void *)0 );
slapi_pblock_set( pb, SLAPI_SEARCH_STRFILTER, (void *)filter );
slapi_pblock_set( pb, SLAPI_SEARCH_ATTRS, (void *)attrs );
- slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)attrsonly );
+ slapi_pblock_set( pb, SLAPI_SEARCH_ATTRSONLY, (void *)&attrsonly );
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
- slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
- slapi_pblock_set( pb, SLAPI_SEARCH_DEREF, (void *)0 );
- slapi_pblock_set( pb, SLAPI_SEARCH_SIZELIMIT, (void *)SLAP_NO_LIMIT );
- slapi_pblock_set( pb, SLAPI_SEARCH_TIMELIMIT, (void *)SLAP_NO_LIMIT );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
+ slapi_pblock_set( pb, SLAPI_SEARCH_DEREF, (void *)&deref );
+ slapi_pblock_set( pb, SLAPI_SEARCH_SIZELIMIT, (void *)&no_limit );
+ slapi_pblock_set( pb, SLAPI_SEARCH_TIMELIMIT, (void *)&no_limit );
slapi_int_set_operation_dn( pb );
}
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
- slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
slapi_int_set_operation_dn( pb );
}
pb = slapi_pblock_new();
slapi_modify_internal_set_pb( pb, ldn, mods, controls, NULL, NULL, 0 );
- slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)log_change );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
slapi_modify_internal_pb( pb );
return pb;
slapi_pblock_set( pb, SLAPI_MODIFY_MODS, (void *)attrs );
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
- slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
slapi_int_set_operation_dn( pb );
return 0;
pb = slapi_pblock_new();
slapi_add_internal_set_pb( pb, dn, attrs, controls, NULL, 0);
- slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)log_change );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
slapi_add_internal_pb( pb );
return pb;
slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
- slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
slapi_int_set_operation_dn( pb );
}
pb = slapi_pblock_new();
slapi_add_entry_internal_set_pb( pb, e, controls, NULL, 0 );
- slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)log_change );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
slapi_add_internal_pb( pb );
return pb;
slapi_pblock_set( pb, SLAPI_MODRDN_TARGET, (void *)olddn );
slapi_pblock_set( pb, SLAPI_MODRDN_NEWRDN, (void *)newrdn );
slapi_pblock_set( pb, SLAPI_MODRDN_NEWSUPERIOR, (void *)newsuperior );
- slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)deloldrdn );
+ slapi_pblock_set( pb, SLAPI_MODRDN_DELOLDRDN, (void *)&deloldrdn );
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
- slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
slapi_int_set_operation_dn( pb );
}
slapi_rename_internal_set_pb( pb, olddn, lnewrdn, NULL,
deloldrdn, controls, NULL, NULL, 0 );
- slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)log_change );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
slapi_modrdn_internal_pb( pb );
return pb;
slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)controls );
slapi_pblock_set( pb, SLAPI_TARGET_UNIQUEID, (void *)uniqueid );
slapi_pblock_set( pb, SLAPI_PLUGIN_IDENTITY, (void *)plugin_identity );
- slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)operation_flags );
+ slapi_pblock_set( pb, SLAPI_X_INTOP_FLAGS, (void *)&operation_flags );
slapi_int_set_operation_dn( pb );
}
pb = slapi_pblock_new();
slapi_delete_internal_set_pb( pb, ldn, controls, NULL, NULL, 0 );
- slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)log_change );
+ slapi_pblock_set( pb, SLAPI_LOG_OPERATION, (void *)&log_change );
slapi_delete_internal_pb( pb );
return pb;
case SLAPI_DB2LDIF_PRINTKEY:
case SLAPI_LDIF2DB_REMOVEDUPVALS:
case SLAPI_MANAGEDSAIT:
- case SLAPI_REQUESTOR_ISUPDATEDN:
+ case SLAPI_IS_REPLICATED_OPERATION:
case SLAPI_X_CONN_IS_UDP:
case SLAPI_X_CONN_SSF:
case SLAPI_RESULT_CODE:
+ case SLAPI_LOG_OPERATION:
return PBLOCK_CLASS_INTEGER;
break;
case SLAPI_SEARCH_RESULT_SET:
case SLAPI_SEARCH_RESULT_ENTRY:
case SLAPI_SEARCH_REFERRALS:
- case SLAPI_LOG_OPERATION:
case SLAPI_RESULT_TEXT:
case SLAPI_RESULT_MATCHED:
case SLAPI_X_GROUP_ENTRY:
if ( pb->curParams[i] == param ) {
switch ( pbClass ) {
case PBLOCK_CLASS_INTEGER:
- *((int *)value) = (int)pb->curVals[i];
+ *((int *)value) = pb->curVals[i].pv_integer;
break;
case PBLOCK_CLASS_LONG_INTEGER:
- *((long *)value) = (long)pb->curVals[i];
+ *((long *)value) = pb->curVals[i].pv_long_integer;
break;
case PBLOCK_CLASS_POINTER:
+ *value = pb->curVals[i].pv_pointer;
+ break;
case PBLOCK_CLASS_FUNCTION_POINTER:
- *value = pb->curVals[i];
+ *value = pb->curVals[i].pv_function_pointer;
break;
default:
break;
return PBLOCK_ERROR;
}
- for ( i = 0; i < pb->numParams; i++ ) {
+ for ( i = 0; i < pb->numParams; i++ ) {
if ( pb->curParams[i] == param ) {
+ switch ( pbClass ) {
+ case PBLOCK_CLASS_INTEGER:
+ pb->curVals[i].pv_integer = (*((int *)value));
+ break;
+ case PBLOCK_CLASS_LONG_INTEGER:
+ pb->curVals[i].pv_long_integer = (*((long *)value));
+ break;
+ case PBLOCK_CLASS_POINTER:
+ pb->curVals[i].pv_pointer = value;
+ break;
+ case PBLOCK_CLASS_FUNCTION_POINTER:
+ pb->curVals[i].pv_function_pointer = value;
+ break;
+ default:
+ break;
+ }
break;
- }
+ }
}
if ( i >= pb->numParams ) {
pb->numParams++;
}
- pb->curVals[i] = value;
-
return PBLOCK_SUCCESS;
}
break;
case SLAPI_OPINITIATED_TIME:
PBLOCK_ASSERT_OP( pb, 0 );
- *((time_t *)value) = pb->pop->o_time;
+ *((long *)value) = pb->pop->o_time;
break;
case SLAPI_OPERATION_ID:
PBLOCK_ASSERT_OP( pb, 0 );
- *((unsigned long *)value) = pb->pop->o_opid;
+ *((long *)value) = pb->pop->o_opid;
break;
case SLAPI_OPERATION_TYPE:
PBLOCK_ASSERT_OP( pb, 0 );
PBLOCK_ASSERT_OP( pb, 0 );
*((int *)value) = be_isroot( pb->pop );
break;
- case SLAPI_REQUESTOR_ISUPDATEDN:
+ case SLAPI_IS_REPLICATED_OPERATION:
PBLOCK_ASSERT_OP( pb, 0 );
*((int *)value) = be_isupdate( pb->pop );
break;
break;
case SLAPI_CONN_ID:
PBLOCK_ASSERT_CONN( pb );
- *((unsigned long *)value) = pb->pconn->c_connid;
+ *((long *)value) = pb->pconn->c_connid;
break;
case SLAPI_CONN_DN:
PBLOCK_ASSERT_CONN( pb );
break;
case SLAPI_OPINITIATED_TIME:
PBLOCK_ASSERT_OP( pb, 0 );
- pb->pop->o_time = (time_t)value;
+ pb->pop->o_time = *((long *)value);
break;
case SLAPI_OPERATION_ID:
PBLOCK_ASSERT_OP( pb, 0 );
- pb->pop->o_opid = (unsigned long)value;
+ pb->pop->o_opid = *((long *)value);
break;
case SLAPI_OPERATION_TYPE:
PBLOCK_ASSERT_OP( pb, 0 );
- pb->pop->o_tag = (ber_tag_t)value;
+ pb->pop->o_tag = *((ber_tag_t *)value);
break;
case SLAPI_REQCONTROLS:
PBLOCK_ASSERT_OP( pb, 0 );
break;
case SLAPI_MANAGEDSAIT:
PBLOCK_ASSERT_OP( pb, 0 );
- pb->pop->o_managedsait = (int)value;
+ pb->pop->o_managedsait = *((int *)value);
break;
case SLAPI_BACKEND:
PBLOCK_ASSERT_OP( pb, 0 );
case SLAPI_CONN_ID:
PBLOCK_ASSERT_CONN( pb );
PBLOCK_LOCK_CONN( pb );
- pb->pconn->c_connid = (unsigned long)value;
+ pb->pconn->c_connid = *((long *)value);
PBLOCK_UNLOCK_CONN( pb );
break;
case SLAPI_CONN_DN:
break;
case SLAPI_RESULT_CODE:
case SLAPI_PLUGIN_INTOP_RESULT:
- pb->rs.sr_err = (int)value;
+ pb->rs.sr_err = *((int *)value);
break;
case SLAPI_RESULT_TEXT:
snprintf( pb->textbuf, sizeof( pb->textbuf ), "%s", (char *)value );
PBLOCK_ASSERT_OP( pb, 0 );
PBLOCK_VALIDATE_IS_INTOP( pb );
if ( pb->pop->o_tag == LDAP_REQ_MODRDN )
- pb->pop->orr_deleteoldrdn = (int)value;
+ pb->pop->orr_deleteoldrdn = *((int *)value);
else
rc = PBLOCK_ERROR;
break;
- case SLAPI_SEARCH_SCOPE:
+ case SLAPI_SEARCH_SCOPE: {
+ int scope = *((int *)value);
+
PBLOCK_ASSERT_OP( pb, 0 );
if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) {
- switch ( (int)value ) {
+ switch ( *((int *)value) ) {
case LDAP_SCOPE_BASE:
case LDAP_SCOPE_ONELEVEL:
case LDAP_SCOPE_SUBTREE:
#ifdef LDAP_SCOPE_SUBORDINATE
case LDAP_SCOPE_SUBORDINATE:
#endif
- pb->pop->ors_scope = (int)value;
+ pb->pop->ors_scope = scope;
break;
default:
rc = PBLOCK_ERROR;
rc = PBLOCK_ERROR;
}
break;
+ }
case SLAPI_SEARCH_DEREF:
PBLOCK_ASSERT_OP( pb, 0 );
if ( pb->pop->o_tag == LDAP_REQ_SEARCH )
- pb->pop->ors_deref = (int)value;
+ pb->pop->ors_deref = *((int *)value);
else
rc = PBLOCK_ERROR;
break;
case SLAPI_SEARCH_SIZELIMIT:
PBLOCK_ASSERT_OP( pb, 0 );
if ( pb->pop->o_tag == LDAP_REQ_SEARCH )
- pb->pop->ors_slimit = (int)value;
+ pb->pop->ors_slimit = *((int *)value);
else
rc = PBLOCK_ERROR;
break;
case SLAPI_SEARCH_TIMELIMIT:
PBLOCK_ASSERT_OP( pb, 0 );
if ( pb->pop->o_tag == LDAP_REQ_SEARCH )
- pb->pop->ors_tlimit = (int)value;
+ pb->pop->ors_tlimit = *((int *)value);
else
rc = PBLOCK_ERROR;
break;
PBLOCK_VALIDATE_IS_INTOP( pb );
if ( pb->pop->o_tag == LDAP_REQ_SEARCH )
- pb->pop->ors_attrsonly = (int)value;
+ pb->pop->ors_attrsonly = *((int *)value);
else
rc = PBLOCK_ERROR;
break;
PBLOCK_VALIDATE_IS_INTOP( pb );
if ( pb->pop->o_tag == LDAP_REQ_BIND )
- pb->pop->orb_method = (int)value;
+ pb->pop->orb_method = *((int *)value);
else
rc = PBLOCK_ERROR;
break;
rc = PBLOCK_ERROR;
break;
case SLAPI_REQUESTOR_ISROOT:
- case SLAPI_REQUESTOR_ISUPDATEDN:
+ case SLAPI_IS_REPLICATED_OPERATION:
case SLAPI_CONN_AUTHTYPE:
case SLAPI_CONN_AUTHMETHOD:
case SLAPI_X_CONN_IS_UDP:
memset( pb->curParams, 0, sizeof(pb->curParams) );
memset( pb->curVals, 0, sizeof(pb->curVals) );
pb->curParams[0] = SLAPI_IBM_PBLOCK;
- pb->curVals[0] = NULL;
+ pb->curVals[0].pv_pointer = NULL;
pb->numParams = 1;
pb->pconn = NULL;
pb->pop = NULL;
{
Slapi_PBlock *pPlugin = NULL;
int rc;
+ int type = SLAPI_PLUGIN_OBJECT;
pPlugin = slapi_pblock_new();
if ( pPlugin == NULL ) {
goto done;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)SLAPI_PLUGIN_OBJECT );
+ rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)&type );
if ( rc != LDAP_SUCCESS ) {
goto done;
}
{
Slapi_PBlock *pPlugin = NULL;
int rc;
+ int type = SLAPI_PLUGIN_OBJECT;
pPlugin = slapi_pblock_new();
if ( pPlugin == NULL ) {
goto done;
}
- rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)SLAPI_PLUGIN_OBJECT );
+ rc = slapi_pblock_set( pPlugin, SLAPI_PLUGIN_TYPE, (void *)&type );
if ( rc != LDAP_SUCCESS ) {
goto done;
}