}
#if defined( LDAP_SLAPI )
- if ( op->o_pb != NULL ) {
- slapi_pblock_destroy( (Slapi_PBlock *)op->o_pb );
+ if ( SLAPI_OPERATION_PBLOCK( op ) ) {
+ slapi_pblock_destroy( SLAPI_OPERATION_PBLOCK( op ) );
slapi_int_free_object_extensions( SLAPI_X_EXT_OPERATION, op );
}
#endif /* defined( LDAP_SLAPI ) */
#if defined( LDAP_SLAPI )
if ( slapi_plugins_used ) {
- op->o_pb = slapi_pblock_new();
+ SLAPI_OPERATION_PBLOCK( op ) = slapi_pblock_new();
slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
}
#endif /* defined( LDAP_SLAPI ) */
assert( be != NULL );
- pTmpPB = (Slapi_PBlock *)be->be_pb;
+ pTmpPB = SLAPI_BACKEND_PBLOCK( be );
if ( pTmpPB == NULL ) {
- be->be_pb = (void *)pPB;
+ SLAPI_BACKEND_PBLOCK( be ) = pPB;
} else {
while ( pTmpPB != NULL && rc == LDAP_SUCCESS ) {
pSavePB = pTmpPB;
goto done;
}
- pCurrentPB = (Slapi_PBlock *)be->be_pb;
+ pCurrentPB = SLAPI_BACKEND_PBLOCK( be );
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
goto done;
}
- pCurrentPB = (Slapi_PBlock *)be->be_pb;
+ pCurrentPB = SLAPI_BACKEND_PBLOCK( be );
while ( pCurrentPB != NULL && rc == LDAP_SUCCESS ) {
rc = slapi_pblock_get( pCurrentPB, functype, &FuncPtr );
idx.bv_val = ibuf;
i = 0;
- for ( pp = be->be_pb;
+ for ( pp = SLAPI_BACKEND_PBLOCK( be );
pp != NULL;
slapi_pblock_get( pp, SLAPI_IBM_PBLOCK, &pp ) )
{
#define SLAPI_OVERLAY_NAME "slapi"
+#define SLAPI_OPERATION_PBLOCK(_op) ((op)->o_pb)
+#define SLAPI_CONNECTION_PBLOCK(_conn) ((conn)->c_pb);
+#define SLAPI_BACKEND_PBLOCK(_be) ((be)->be_pb)
+
#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
size_t i;
plugin_result_callback prc = NULL;
void *callback_data = NULL;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
- assert( op->o_pb != NULL );
+ assert( pb != NULL );
- slapi_pblock_get( op->o_pb, SLAPI_RESCONTROLS, (void **)&controls );
- slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void **)&prc );
- slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
+ slapi_pblock_get( pb, SLAPI_RESCONTROLS, (void **)&controls );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void **)&prc );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
assert( controls == NULL );
controls[i] = NULL;
}
- slapi_pblock_set( op->o_pb, SLAPI_RESCONTROLS, (void *)controls );
- slapi_pblock_set( op->o_pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs->sr_err );
+ slapi_pblock_set( pb, SLAPI_RESCONTROLS, (void *)controls );
+ slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs->sr_err );
if ( prc != NULL ) {
(*prc)( rs->sr_err, callback_data );
{
plugin_search_entry_callback psec = NULL;
void *callback_data = NULL;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
- assert( op->o_pb != NULL );
+ assert( pb != NULL );
- slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void **)&psec );
- slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_SEARCH_ENTRY_CALLBACK, (void **)&psec );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
if ( psec != NULL ) {
return (*psec)( rs->sr_entry, callback_data );
Operation *op,
SlapReply *rs )
{
- assert( op->o_pb != NULL );
+ assert( SLAPI_OPERATION_PBLOCK( op ) != NULL );
return;
}
int i, rc = LDAP_SUCCESS;
plugin_referral_entry_callback prec = NULL;
void *callback_data = NULL;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
- assert( op->o_pb != NULL );
+ assert( pb != NULL );
- slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void **)&prec );
- slapi_pblock_get( op->o_pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void **)&prec );
+ slapi_pblock_get( pb, SLAPI_X_INTOP_CALLBACK_DATA, &callback_data );
if ( prec != NULL ) {
for ( i = 0; rs->sr_ref[i].bv_val != NULL; i++ ) {
rc = slapi_int_pblock_get_operation( pb, op, rs );
- slapi_pblock_set( op->o_pb, SLAPI_OPERATION, op );
- slapi_pblock_set( op->o_pb, SLAPI_CONNECTION, conn );
+ slapi_pblock_set( pb, SLAPI_OPERATION, op );
+ slapi_pblock_set( pb, SLAPI_CONNECTION, conn );
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
{
Connection *conn = *pConn;
Operation *op;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
if ( conn == NULL ) {
return;
ber_sockbuf_free( conn->c_sb );
}
- slapi_pblock_set( op->o_pb, SLAPI_OPERATION, NULL );
- slapi_pblock_set( op->o_pb, SLAPI_CONNECTION, NULL );
+ slapi_pblock_set( pb, SLAPI_OPERATION, NULL );
+ slapi_pblock_set( pb, SLAPI_CONNECTION, NULL );
if ( op != NULL ) {
slapi_ch_free( (void **)&op );
AttributeName *anp;
AccessControlState acl_state = ACL_STATE_INIT;
- ctx.cac_pb = op->o_pb;
+ ctx.cac_pb = SLAPI_OPERATION_PBLOCK( op );
ctx.cac_op = op;
ctx.cac_private = rs;
ctx.cac_acl_state = &acl_state;
static int
slapi_over_merge_controls( Operation *op, SlapReply *rs, Slapi_PBlock *pb)
{
- LDAPControl **slapiControls = NULL, **resControls;
- int nSlapiControls = 0;
- int nResControls = 0;
- int i;
+ LDAPControl **slapiControls = NULL, **resControls;
+ int nSlapiControls = 0;
+ int nResControls = 0;
+ int i;
/* merge in controls */
if ( rs->sr_ctrls != NULL ) {
for ( nResControls = 0; rs->sr_ctrls[nResControls] != NULL; nResControls++ )
;
}
- slapi_pblock_get( op->o_pb, SLAPI_RESCONTROLS, (void **)&slapiControls );
+ slapi_pblock_get( pb, SLAPI_RESCONTROLS, (void **)&slapiControls );
if ( slapiControls != NULL ) {
for ( nSlapiControls = 0; slapiControls[nSlapiControls] != NULL; nSlapiControls++ )
;
if ( slapiControls != NULL ) {
slapi_ch_free( (void **)&slapiControls );
- slapi_pblock_set( op->o_pb, SLAPI_RESCONTROLS, NULL ); /* don't free */
+ slapi_pblock_set( pb, SLAPI_RESCONTROLS, NULL ); /* don't free */
}
rs->sr_ctrls = resControls;
static int
slapi_over_result( Operation *op, SlapReply *rs, int type )
{
- int rc;
+ int rc;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
assert( rs->sr_type == REP_RESULT );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_CODE, (void *)rs->sr_err );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_TEXT, (void *)rs->sr_text );
- slapi_pblock_set( op->o_pb, SLAPI_RESULT_MATCHED, (void *)rs->sr_matched );
+ slapi_pblock_set( pb, SLAPI_RESULT_CODE, (void *)rs->sr_err );
+ slapi_pblock_set( pb, SLAPI_RESULT_TEXT, (void *)rs->sr_text );
+ slapi_pblock_set( pb, SLAPI_RESULT_MATCHED, (void *)rs->sr_matched );
- rc = slapi_int_call_plugins( op->o_bd, type, op->o_pb );
+ rc = slapi_int_call_plugins( op->o_bd, type, pb );
- slapi_pblock_get( op->o_pb, SLAPI_RESULT_CODE, (void **)&rs->sr_err );
- slapi_pblock_get( op->o_pb, SLAPI_RESULT_TEXT, (void **)&rs->sr_text );
- slapi_pblock_get( op->o_pb, SLAPI_RESULT_MATCHED, (void **)&rs->sr_matched );
+ slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void **)&rs->sr_err );
+ slapi_pblock_get( pb, SLAPI_RESULT_TEXT, (void **)&rs->sr_text );
+ slapi_pblock_get( pb, SLAPI_RESULT_MATCHED, (void **)&rs->sr_matched );
if ( type == SLAPI_PLUGIN_PRE_RESULT_FN ) {
- rc = slapi_over_merge_controls( op, rs, op->o_pb );
+ rc = slapi_over_merge_controls( op, rs, pb );
}
return SLAP_CB_CONTINUE;
static int
slapi_op_func( Operation *op, SlapReply *rs )
{
- Slapi_PBlock *pb = op->o_pb;
+ Slapi_PBlock *pb;
slap_operation_t which;
struct slapi_op_info *opinfo;
int rc, flags = 0;
slap_overinst *on;
slap_callback cb;
+ pb = SLAPI_OPERATION_PBLOCK( op );
+
/*
* We check for op->o_extensions to verify that we are not
* processing a SLAPI internal operation. XXX
*/
- if ( op->o_pb == NULL || op->o_extensions == NULL ) {
+ if ( pb == NULL || op->o_extensions == NULL ) {
return SLAP_CB_CONTINUE;
}
static int
slapi_over_extended( Operation *op, SlapReply *rs )
{
- Slapi_PBlock *pb = op->o_pb;
+ Slapi_PBlock *pb;
SLAPI_FUNC callback;
int sentResult = 0;
int rc;
struct berval reqdata = BER_BVNULL;
+ pb = SLAPI_OPERATION_PBLOCK( op );
+ if ( pb == NULL ) {
+ return SLAP_CB_CONTINUE;
+ }
+
slapi_int_get_extop_plugin( &op->ore_reqoid, &callback );
if ( callback == NULL ) {
return SLAP_CB_CONTINUE;
{
Slapi_Entry *e;
int rc;
- Slapi_PBlock *pb = op->o_pb;
+ Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op );
BackendDB *be = NULL;
BackendDB *be_orig = op->o_bd;
{
#if defined(LDAP_SLAPI)
assert( pb != NULL );
- *pb = (Slapi_PBlock *)be->be_pb;
+ *pb = SLAPI_BACKEND_PBLOCK( be );
return (*pb == NULL ? LDAP_OTHER : LDAP_SUCCESS);
#else /* LDAP_SLAPI */
return LDAP_OTHER;
#ifdef LDAP_SLAPI
int rc, slap_access = 0;
slapi_acl_callback_t *pGetPlugin, *tmpPlugin;
+ Slapi_PBlock *pb;
- if ( op->o_pb == NULL ) {
+ pb = SLAPI_OPERATION_PBLOCK( op );
+ if ( pb == NULL ) {
/* internal operation */
return 1;
}
* 0 access denied
* 1 access granted
*/
- rc = (*pGetPlugin)( op->o_pb, entry, desc->ad_cname.bv_val,
- val, slap_access, (void *)state );
+ rc = (*pGetPlugin)( pb, entry, desc->ad_cname.bv_val,
+ val, slap_access, (void *)state );
if ( rc == 0 ) {
break;
}