#define PBLOCK_ASSERT_OP( _pb, _tag ) do { \
PBLOCK_ASSERT_CONN( _pb ); \
assert( (_pb)->pb_op != NULL ); \
+ assert( (_pb)->pb_rs != NULL ); \
if ( _tag != 0 ) \
assert( (_pb)->pb_op->o_tag == (_tag)); \
} while (0)
/* native types */
Connection *pb_conn;
Operation *pb_op;
- SlapReply pb_rs;
+ SlapReply *pb_rs;
int pb_intop;
char pb_textbuf[ SLAP_TEXT_BUFLEN ];
};
if ( pb->pb_op->o_ctrls != NULL ) {
for ( c = pb->pb_op->o_ctrls; *c != NULL; c++ ) {
- rc = slap_parse_ctrl( pb->pb_op, &pb->pb_rs, *c, &pb->pb_rs.sr_text );
+ rc = slap_parse_ctrl( pb->pb_op, pb->pb_rs, *c, &pb->pb_rs->sr_text );
if ( rc != LDAP_SUCCESS )
break;
}
slapi_int_create_object_extensions( SLAPI_X_EXT_OPERATION, op );
slapi_int_create_object_extensions( SLAPI_X_EXT_CONNECTION, conn );
+ pb->pb_rs = (SlapReply *)slapi_ch_calloc( 1, sizeof(SlapReply) );
pb->pb_op = op;
pb->pb_conn = conn;
pb->pb_intop = 1;
slapi_ch_free( (void **)&pb->pb_op->o_callback );
slapi_ch_free( (void **)&pb->pb_op );
slapi_ch_free( (void **)&pb->pb_conn );
+ slapi_ch_free( (void **)&pb->pb_rs );
}
static int
slapi_int_func_internal_pb( Slapi_PBlock *pb, slap_operation_t which )
{
BI_op_bind **func;
- SlapReply *rs = &pb->pb_rs;
+ SlapReply *rs = pb->pb_rs;
int rc;
PBLOCK_ASSERT_INTOP( pb, 0 );
func = &pb->pb_op->o_bd->be_bind;
- return func[which]( pb->pb_op, &pb->pb_rs );
+ return func[which]( pb->pb_op, pb->pb_rs );
}
int
PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_ADD );
- rs = &pb->pb_rs;
+ rs = pb->pb_rs;
entry_orig = pb->pb_op->ora_e;
pb->pb_op->ora_e = NULL;
PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODRDN );
if ( BER_BVISEMPTY( &pb->pb_op->o_req_ndn ) ) {
- pb->pb_rs.sr_err = LDAP_UNWILLING_TO_PERFORM;
+ pb->pb_rs->sr_err = LDAP_UNWILLING_TO_PERFORM;
goto cleanup;
}
PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODIFY );
- rs = &pb->pb_rs;
+ rs = pb->pb_rs;
if ( pb->pb_op->orm_modlist == NULL ) {
rs->sr_err = LDAP_PARAM_ERROR;
PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_SEARCH );
- rs = &pb->pb_rs;
+ rs = pb->pb_rs;
/* search callback and arguments */
slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void *)prc );
static int slapi_over_cleanup( Operation *op, SlapReply *rs );
static Slapi_PBlock *
-slapi_over_pblock_new( Operation *op )
+slapi_over_pblock_new( Operation *op, SlapReply *rs )
{
Slapi_PBlock *pb;
pb = slapi_pblock_new();
pb->pb_op = op;
pb->pb_conn = op->o_conn;
+ pb->pb_rs = rs;
pb->pb_intop = 0;
PBLOCK_ASSERT_OP( pb, op->o_tag );
}
static int
-slapi_op_internal_p( Operation *op, slap_callback *cb )
+slapi_op_internal_p( Operation *op, SlapReply *rs, slap_callback *cb )
{
int internal_op = 0;
Slapi_PBlock *pb = NULL;
if ( cb != NULL ) {
if ( pb == NULL ) {
- pb = slapi_over_pblock_new( op );
+ pb = slapi_over_pblock_new( op, rs );
}
cb->sc_response = slapi_over_response;
computed_attr_context ctx;
AttributeName *anp;
- if ( slapi_op_internal_p( op, NULL ) ) {
+ if ( slapi_op_internal_p( op, rs, NULL ) ) {
return SLAP_CB_CONTINUE;
}
- ctx.cac_pb = slapi_over_pblock_new( op );
+ ctx.cac_pb = slapi_over_pblock_new( op, rs );
ctx.cac_op = op;
ctx.cac_private = rs;
assert( rs->sr_type == REP_SEARCH || rs->sr_type == REP_SEARCHREF );
/* create a new pblock to not trample on result controls */
- pb = slapi_over_pblock_new( op );
+ pb = slapi_over_pblock_new( op, rs );
rc = slapi_int_call_plugins( op->o_bd, type, pb );
if ( rc >= 0 ) /* 1 means no plugins called */
return SLAP_CB_CONTINUE;
}
- internal_op = slapi_op_internal_p( op, &cb );
+ internal_op = slapi_op_internal_p( op, rs, &cb );
if ( internal_op ) {
preop_type = opinfo->soi_internal_preop;
return SLAP_CB_CONTINUE;
}
- internal_op = slapi_op_internal_p( op, &cb );
+ internal_op = slapi_op_internal_p( op, rs, &cb );
if ( internal_op ) {
return SLAP_CB_CONTINUE;
}
Slapi_PBlock *pb;
slap_callback cb;
int internal_op;
+ SlapReply rs = { REP_RESULT };
- internal_op = slapi_op_internal_p( op, &cb );
+ internal_op = slapi_op_internal_p( op, &rs, &cb );
cb.sc_response = NULL;
cb.sc_cleanup = NULL;
Slapi_PBlock *pb;
BackendDB *be = op->o_bd;
GroupAssertion *g;
+ SlapReply rs = { REP_RESULT };
op->o_bd = select_backend( gr_ndn, 0, 0 );
int internal_op;
slap_callback cb;
- internal_op = slapi_op_internal_p( op, &cb );
+ internal_op = slapi_op_internal_p( op, &rs, &cb );
cb.sc_response = NULL;
cb.sc_cleanup = NULL;
if ( rc >= 0 ) /* 1 means no plugins called */
rc = SLAP_CB_CONTINUE;
else
- rc = pb->pb_rs.sr_err;
+ rc = pb->pb_rs->sr_err;
slapi_pblock_delete_param( pb, SLAPI_X_GROUP_ENTRY );
slapi_pblock_delete_param( pb, SLAPI_X_GROUP_OPERATION_DN );
break;
case SLAPI_RESULT_CODE:
case SLAPI_PLUGIN_INTOP_RESULT:
- *((int *)value) = pb->pb_rs.sr_err;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((int *)value) = pb->pb_rs->sr_err;
break;
case SLAPI_RESULT_TEXT:
- *((const char **)value) = pb->pb_rs.sr_text;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((const char **)value) = pb->pb_rs->sr_text;
break;
case SLAPI_RESULT_MATCHED:
- *((const char **)value) = pb->pb_rs.sr_matched;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((const char **)value) = pb->pb_rs->sr_matched;
break;
case SLAPI_ADD_ENTRY:
PBLOCK_ASSERT_OP( pb, 0 );
*((int *)value) = 0;
break;
case SLAPI_SEARCH_RESULT_ENTRY:
- *((Slapi_Entry **)value) = pb->pb_rs.sr_entry;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((Slapi_Entry **)value) = pb->pb_rs->sr_entry;
break;
case SLAPI_BIND_RET_SASLCREDS:
- *((struct berval **)value) = pb->pb_rs.sr_sasldata;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((struct berval **)value) = pb->pb_rs->sr_sasldata;
break;
case SLAPI_EXT_OP_REQ_OID:
*((const char **)value) = pb->pb_op->ore_reqoid.bv_val;
*((struct berval **)value) = pb->pb_op->ore_reqdata;
break;
case SLAPI_EXT_OP_RET_OID:
- *((const char **)value) = pb->pb_rs.sr_rspoid;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((const char **)value) = pb->pb_rs->sr_rspoid;
break;
case SLAPI_EXT_OP_RET_VALUE:
- *((struct berval **)value) = pb->pb_rs.sr_rspdata;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ *((struct berval **)value) = pb->pb_rs->sr_rspdata;
break;
case SLAPI_BIND_METHOD:
if ( pb->pb_op->o_tag == LDAP_REQ_BIND )
break;
case SLAPI_RESULT_CODE:
case SLAPI_PLUGIN_INTOP_RESULT:
- pb->pb_rs.sr_err = *((int *)value);
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_err = *((int *)value);
break;
case SLAPI_RESULT_TEXT:
+ PBLOCK_ASSERT_OP( pb, 0 );
snprintf( pb->pb_textbuf, sizeof( pb->pb_textbuf ), "%s", (char *)value );
- pb->pb_rs.sr_text = pb->pb_textbuf;
+ pb->pb_rs->sr_text = pb->pb_textbuf;
break;
case SLAPI_RESULT_MATCHED:
- pb->pb_rs.sr_matched = (char *)value; /* XXX should dup? */
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_matched = (char *)value; /* XXX should dup? */
break;
case SLAPI_ADD_ENTRY:
PBLOCK_ASSERT_OP( pb, 0 );
an[i].an_oc_exclude = 0;
an[i].an_name.bv_val = attrs[i];
an[i].an_name.bv_len = strlen( attrs[i] );
- slap_bv2ad( &an[i].an_name, &an[i].an_desc, &pb->pb_rs.sr_text );
+ slap_bv2ad( &an[i].an_name, &an[i].an_desc, &pb->pb_rs->sr_text );
}
an[i].an_name.bv_val = NULL;
an[i].an_name.bv_len = 0;
break;
case SLAPI_SEARCH_RESULT_ENTRY:
PBLOCK_ASSERT_OP( pb, 0 );
- pb->pb_rs.sr_entry = (Slapi_Entry *)value;
+ pb->pb_rs->sr_entry = (Slapi_Entry *)value;
break;
case SLAPI_BIND_RET_SASLCREDS:
- pb->pb_rs.sr_sasldata = (struct berval *)value;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_sasldata = (struct berval *)value;
break;
case SLAPI_EXT_OP_REQ_OID:
PBLOCK_ASSERT_OP( pb, 0 );
rc = PBLOCK_ERROR;
break;
case SLAPI_EXT_OP_RET_OID:
- pb->pb_rs.sr_rspoid = (char *)value;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_rspoid = (char *)value;
break;
case SLAPI_EXT_OP_RET_VALUE:
- pb->pb_rs.sr_rspdata = (struct berval *)value;
+ PBLOCK_ASSERT_OP( pb, 0 );
+ pb->pb_rs->sr_rspdata = (struct berval *)value;
break;
case SLAPI_BIND_METHOD:
PBLOCK_ASSERT_OP( pb, 0 );
pb->pb_nParams = 1;
pb->pb_conn = NULL;
pb->pb_op = NULL;
+ pb->pb_rs = NULL;
pb->pb_intop = 0;
}
return pb;
{
SlapReply *rs;
- assert( pb->pb_op != NULL );
+ PBLOCK_ASSERT_OP( pb, 0 );
- rs = &pb->pb_rs;
+ rs = pb->pb_rs;
rs->sr_err = err;
rs->sr_matched = matched;