From 48c951007a5d0c5f58744805e03da429b5e9170a Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 25 Jul 2005 11:13:15 +0000 Subject: [PATCH] Harmonize Slapi_PBlock field nomenclature with rest of slapd --- servers/slapd/slapi/proto-slapi.h | 10 +- servers/slapd/slapi/slapi.h | 20 +- servers/slapd/slapi/slapi_ops.c | 128 ++++---- servers/slapd/slapi/slapi_overlay.c | 12 +- servers/slapd/slapi/slapi_pblock.c | 436 ++++++++++++++-------------- servers/slapd/slapi/slapi_utils.c | 48 +-- 6 files changed, 326 insertions(+), 328 deletions(-) diff --git a/servers/slapd/slapi/proto-slapi.h b/servers/slapd/slapi/proto-slapi.h index b3dbbf25ed..612ab9f89e 100644 --- a/servers/slapd/slapi/proto-slapi.h +++ b/servers/slapd/slapi/proto-slapi.h @@ -48,20 +48,20 @@ LDAP_SLAPI_F (int) slapi_int_pblock_get_next LDAP_P(( Slapi_PBlock **pb )); #define PBLOCK_ASSERT_CONN( _pb ) do { \ assert( (_pb) != NULL ); \ - assert( (_pb)->pconn != NULL ); \ + assert( (_pb)->pb_conn != NULL ); \ } while (0) #define PBLOCK_ASSERT_OP( _pb, _tag ) do { \ PBLOCK_ASSERT_CONN( _pb ); \ - assert( (_pb)->pop != NULL ); \ + assert( (_pb)->pb_op != NULL ); \ if ( _tag != 0 ) \ - assert( (_pb)->pop->o_tag == (_tag)); \ + assert( (_pb)->pb_op->o_tag == (_tag)); \ } while (0) #define PBLOCK_ASSERT_INTOP( _pb, _tag ) do { \ PBLOCK_ASSERT_OP( _pb, _tag ); \ - assert( (_pb)->internal_op ); \ - assert( pb->pop == (Operation *)pb->pconn->c_pending_ops.stqh_first ); \ + assert( (_pb)->pb_intop ); \ + assert( (_pb)->pb_op == (Operation *)pb->pb_conn->c_pending_ops.stqh_first ); \ } while (0) /* plugin.c */ diff --git a/servers/slapd/slapi/slapi.h b/servers/slapd/slapi/slapi.h index 9006742c0d..3f577026f3 100644 --- a/servers/slapd/slapi/slapi.h +++ b/servers/slapd/slapi/slapi.h @@ -110,20 +110,20 @@ union slapi_pblock_value { int pv_integer; long pv_long_integer; void *pv_pointer; - void (*pv_function_pointer)(void *); + int (*pv_function_pointer)(); }; struct slapi_pblock { - ldap_pvt_thread_mutex_t pblockMutex; - int numParams; - int curParams[PBLOCK_MAX_PARAMS]; - union slapi_pblock_value curVals[PBLOCK_MAX_PARAMS]; + ldap_pvt_thread_mutex_t pb_mutex; + int pb_nParams; + int pb_params[PBLOCK_MAX_PARAMS]; + union slapi_pblock_value pb_values[PBLOCK_MAX_PARAMS]; /* native types */ - Connection *pconn; - Operation *pop; - SlapReply rs; - int internal_op; - char textbuf[ SLAP_TEXT_BUFLEN ]; + Connection *pb_conn; + Operation *pb_op; + SlapReply pb_rs; + int pb_intop; + char pb_textbuf[ SLAP_TEXT_BUFLEN ]; }; #endif /* !NO_PBLOCK_CLASS */ diff --git a/servers/slapd/slapi/slapi_ops.c b/servers/slapd/slapi/slapi_ops.c index 5ca82cedc0..e39da90300 100644 --- a/servers/slapd/slapi/slapi_ops.c +++ b/servers/slapd/slapi/slapi_ops.c @@ -165,9 +165,9 @@ slapi_int_get_ctrls( Slapi_PBlock *pb ) LDAPControl **c; int rc = LDAP_SUCCESS; - if ( pb->pop->o_ctrls != NULL ) { - for ( c = pb->pop->o_ctrls; *c != NULL; c++ ) { - rc = slap_parse_ctrl( pb->pop, &pb->rs, *c, &pb->rs.sr_text ); + 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 ); if ( rc != LDAP_SUCCESS ) break; } @@ -277,9 +277,9 @@ slapi_int_connection_init_pb( Slapi_PBlock *pb, ber_tag_t tag ) op->o_connid = conn->c_connid; op->o_bd = frontendDB; - pb->pop = op; - pb->pconn = conn; - pb->internal_op = 1; + pb->pb_op = op; + pb->pb_conn = conn; + pb->pb_intop = 1; ldap_pvt_thread_mutex_unlock( &conn->c_mutex ); } @@ -288,7 +288,7 @@ static void slapi_int_set_operation_dn( Slapi_PBlock *pb ) { Backend *be; - Operation *op = pb->pop; + Operation *op = pb->pb_op; if ( BER_BVISNULL( &op->o_ndn ) ) { /* set to root DN */ @@ -308,8 +308,8 @@ slapi_int_connection_done_pb( Slapi_PBlock *pb ) PBLOCK_ASSERT_INTOP( pb, 0 ); - conn = pb->pconn; - op = pb->pop; + conn = pb->pb_conn; + op = pb->pb_op; /* free allocated DNs */ if ( !BER_BVISNULL( &op->o_dn ) ) @@ -363,16 +363,16 @@ slapi_int_connection_done_pb( Slapi_PBlock *pb ) ber_sockbuf_free( conn->c_sb ); } - slapi_ch_free( (void **)&pb->pop->o_callback ); - slapi_ch_free( (void **)&pb->pop ); - slapi_ch_free( (void **)&pb->pconn ); + slapi_ch_free( (void **)&pb->pb_op->o_callback ); + slapi_ch_free( (void **)&pb->pb_op ); + slapi_ch_free( (void **)&pb->pb_conn ); } static int slapi_int_func_internal_pb( Slapi_PBlock *pb, slap_operation_t which ) { BI_op_bind **func; - SlapReply *rs = &pb->rs; + SlapReply *rs = &pb->pb_rs; int rc; PBLOCK_ASSERT_INTOP( pb, 0 ); @@ -383,9 +383,9 @@ slapi_int_func_internal_pb( Slapi_PBlock *pb, slap_operation_t which ) return rc; } - func = &pb->pop->o_bd->be_bind; + func = &pb->pb_op->o_bd->be_bind; - return func[which]( pb->pop, &pb->rs ); + return func[which]( pb->pb_op, &pb->pb_rs ); } int @@ -398,7 +398,7 @@ slapi_delete_internal_pb( Slapi_PBlock *pb ) PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_DELETE ); slapi_int_func_internal_pb( pb, op_delete ); - slap_graduate_commit_csn( pb->pop ); + slap_graduate_commit_csn( pb->pb_op ); return 0; } @@ -415,21 +415,21 @@ slapi_add_internal_pb( Slapi_PBlock *pb ) PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_ADD ); - rs = &pb->rs; + rs = &pb->pb_rs; - entry_orig = pb->pop->ora_e; - pb->pop->ora_e = NULL; + entry_orig = pb->pb_op->ora_e; + pb->pb_op->ora_e = NULL; if ( entry_orig != NULL ) { - if ( pb->pop->ora_modlist != NULL || !BER_BVISNULL( &pb->pop->o_req_ndn )) { + if ( pb->pb_op->ora_modlist != NULL || !BER_BVISNULL( &pb->pb_op->o_req_ndn )) { rs->sr_err = LDAP_PARAM_ERROR; goto cleanup; } - assert( BER_BVISNULL( &pb->pop->o_req_dn ) ); /* shouldn't get set */ - ber_dupbv( &pb->pop->o_req_dn, &entry_orig->e_name ); - ber_dupbv( &pb->pop->o_req_ndn, &entry_orig->e_nname ); - } else if ( pb->pop->ora_modlist == NULL || BER_BVISNULL( &pb->pop->o_req_ndn )) { + assert( BER_BVISNULL( &pb->pb_op->o_req_dn ) ); /* shouldn't get set */ + ber_dupbv( &pb->pb_op->o_req_dn, &entry_orig->e_name ); + ber_dupbv( &pb->pb_op->o_req_ndn, &entry_orig->e_nname ); + } else if ( pb->pb_op->ora_modlist == NULL || BER_BVISNULL( &pb->pb_op->o_req_ndn )) { rs->sr_err = LDAP_PARAM_ERROR; goto cleanup; } @@ -438,53 +438,53 @@ slapi_add_internal_pb( Slapi_PBlock *pb ) * The caller can specify a new entry, or a target DN and set * of modifications, but not both. */ - pb->pop->ora_e = (Entry *)slapi_ch_calloc( 1, sizeof(Entry) ); - ber_dupbv( &pb->pop->ora_e->e_name, &pb->pop->o_req_dn ); - ber_dupbv( &pb->pop->ora_e->e_nname, &pb->pop->o_req_ndn ); + pb->pb_op->ora_e = (Entry *)slapi_ch_calloc( 1, sizeof(Entry) ); + ber_dupbv( &pb->pb_op->ora_e->e_name, &pb->pb_op->o_req_dn ); + ber_dupbv( &pb->pb_op->ora_e->e_nname, &pb->pb_op->o_req_ndn ); if ( entry_orig != NULL ) { - assert( pb->pop->ora_modlist == NULL ); + assert( pb->pb_op->ora_modlist == NULL ); - rs->sr_err = slap_entry2mods( entry_orig, &pb->pop->ora_modlist, - &rs->sr_text, pb->textbuf, sizeof( pb->textbuf ) ); + rs->sr_err = slap_entry2mods( entry_orig, &pb->pb_op->ora_modlist, + &rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ) ); if ( rs->sr_err != LDAP_SUCCESS ) { goto cleanup; } } else { - assert( pb->pop->ora_modlist != NULL ); + assert( pb->pb_op->ora_modlist != NULL ); } - rs->sr_err = slap_mods_check( pb->pop->ora_modlist, &rs->sr_text, - pb->textbuf, sizeof( pb->textbuf ), NULL ); + rs->sr_err = slap_mods_check( pb->pb_op->ora_modlist, &rs->sr_text, + pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL ); if ( rs->sr_err != LDAP_SUCCESS ) { goto cleanup; } if ( slapi_int_func_internal_pb( pb, op_add ) == 0 ) { - if ( pb->pop->ora_e != NULL && pb->pop->o_private != NULL ) { - BackendDB *bd = pb->pop->o_bd; + if ( pb->pb_op->ora_e != NULL && pb->pb_op->o_private != NULL ) { + BackendDB *bd = pb->pb_op->o_bd; /* could we use SLAPI_BACKEND instead? */ - pb->pop->o_bd = (BackendDB *)pb->pop->o_private; - pb->pop->o_private = NULL; - be_entry_release_w( pb->pop, pb->pop->ora_e ); - pb->pop->ora_e = NULL; - pb->pop->o_bd = bd; - pb->pop->o_private = NULL; + pb->pb_op->o_bd = (BackendDB *)pb->pb_op->o_private; + pb->pb_op->o_private = NULL; + be_entry_release_w( pb->pb_op, pb->pb_op->ora_e ); + pb->pb_op->ora_e = NULL; + pb->pb_op->o_bd = bd; + pb->pb_op->o_private = NULL; } } cleanup: - slap_graduate_commit_csn( pb->pop ); + slap_graduate_commit_csn( pb->pb_op ); - if ( pb->pop->ora_e != NULL ) { - slapi_entry_free( pb->pop->ora_e ); - pb->pop->ora_e = NULL; + if ( pb->pb_op->ora_e != NULL ) { + slapi_entry_free( pb->pb_op->ora_e ); + pb->pb_op->ora_e = NULL; } if ( entry_orig != NULL ) { - pb->pop->ora_e = entry_orig; - slapi_int_mods_free( pb->pop->ora_modlist ); - pb->pop->ora_modlist = NULL; + pb->pb_op->ora_e = entry_orig; + slapi_int_mods_free( pb->pb_op->ora_modlist ); + pb->pb_op->ora_modlist = NULL; } return 0; @@ -499,15 +499,15 @@ slapi_modrdn_internal_pb( Slapi_PBlock *pb ) PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODRDN ); - if ( BER_BVISEMPTY( &pb->pop->o_req_ndn ) ) { - pb->rs.sr_err = LDAP_UNWILLING_TO_PERFORM; + if ( BER_BVISEMPTY( &pb->pb_op->o_req_ndn ) ) { + pb->pb_rs.sr_err = LDAP_UNWILLING_TO_PERFORM; goto cleanup; } slapi_int_func_internal_pb( pb, op_modrdn ); cleanup: - slap_graduate_commit_csn( pb->pop ); + slap_graduate_commit_csn( pb->pb_op ); return 0; } @@ -523,20 +523,20 @@ slapi_modify_internal_pb( Slapi_PBlock *pb ) PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_MODIFY ); - rs = &pb->rs; + rs = &pb->pb_rs; - if ( pb->pop->orm_modlist == NULL ) { + if ( pb->pb_op->orm_modlist == NULL ) { rs->sr_err = LDAP_PARAM_ERROR; goto cleanup; } - if ( BER_BVISEMPTY( &pb->pop->o_req_ndn ) ) { + if ( BER_BVISEMPTY( &pb->pb_op->o_req_ndn ) ) { rs->sr_err = LDAP_UNWILLING_TO_PERFORM; goto cleanup; } - rs->sr_err = slap_mods_check( pb->pop->orm_modlist, - &rs->sr_text, pb->textbuf, sizeof( pb->textbuf ), NULL ); + rs->sr_err = slap_mods_check( pb->pb_op->orm_modlist, + &rs->sr_text, pb->pb_textbuf, sizeof( pb->pb_textbuf ), NULL ); if ( rs->sr_err != LDAP_SUCCESS ) { goto cleanup; } @@ -544,7 +544,7 @@ slapi_modify_internal_pb( Slapi_PBlock *pb ) slapi_int_func_internal_pb( pb, op_modify ); cleanup: - slap_graduate_commit_csn( pb->pop ); + slap_graduate_commit_csn( pb->pb_op ); return 0; } @@ -618,7 +618,7 @@ slapi_search_internal_callback_pb( Slapi_PBlock *pb, PBLOCK_ASSERT_INTOP( pb, LDAP_REQ_SEARCH ); - rs = &pb->rs; + rs = &pb->pb_rs; /* search callback and arguments */ slapi_pblock_set( pb, SLAPI_X_INTOP_RESULT_CALLBACK, (void *)prc ); @@ -626,14 +626,14 @@ slapi_search_internal_callback_pb( Slapi_PBlock *pb, slapi_pblock_set( pb, SLAPI_X_INTOP_REFERRAL_ENTRY_CALLBACK, (void *)prec ); slapi_pblock_set( pb, SLAPI_X_INTOP_CALLBACK_DATA, (void *)callback_data ); - if ( BER_BVISEMPTY( &pb->pop->ors_filterstr )) { + if ( BER_BVISEMPTY( &pb->pb_op->ors_filterstr )) { rs->sr_err = LDAP_PARAM_ERROR; goto cleanup; } - if ( pb->pop->ors_filter == NULL ) { - pb->pop->ors_filter = slapi_str2filter( pb->pop->ors_filterstr.bv_val ); - if ( pb->pop->ors_filter == NULL ) { + if ( pb->pb_op->ors_filter == NULL ) { + pb->pb_op->ors_filter = slapi_str2filter( pb->pb_op->ors_filterstr.bv_val ); + if ( pb->pb_op->ors_filter == NULL ) { rs->sr_err = LDAP_PROTOCOL_ERROR; goto cleanup; } @@ -645,8 +645,8 @@ slapi_search_internal_callback_pb( Slapi_PBlock *pb, cleanup: if ( free_filter ) { - slapi_filter_free( pb->pop->ors_filter, 1 ); - pb->pop->ors_filter = NULL; + slapi_filter_free( pb->pb_op->ors_filter, 1 ); + pb->pb_op->ors_filter = NULL; } slapi_pblock_delete_param( pb, SLAPI_X_INTOP_RESULT_CALLBACK ); diff --git a/servers/slapd/slapi/slapi_overlay.c b/servers/slapd/slapi/slapi_overlay.c index 1cc39940af..70ee045afd 100644 --- a/servers/slapd/slapi/slapi_overlay.c +++ b/servers/slapd/slapi/slapi_overlay.c @@ -41,9 +41,9 @@ slapi_over_pblock_new( Operation *op ) Slapi_PBlock *pb; pb = slapi_pblock_new(); - pb->pop = op; - pb->pconn = op->o_conn; - pb->internal_op = 0; + pb->pb_op = op; + pb->pb_conn = op->o_conn; + pb->pb_intop = 0; PBLOCK_ASSERT_OP( pb, op->o_tag ); @@ -469,7 +469,7 @@ slapi_over_response( Operation *op, SlapReply *rs ) Slapi_PBlock *pb = SLAPI_OPERATION_PBLOCK( op ); int rc = SLAP_CB_CONTINUE; - if ( pb->internal_op == 0 ) { + if ( pb->pb_intop == 0 ) { switch ( rs->sr_type ) { case REP_RESULT: rc = slapi_over_result( op, rs, SLAPI_PLUGIN_PRE_RESULT_FN ); @@ -498,7 +498,7 @@ slapi_over_cleanup( Operation *op, SlapReply *rs ) slapi_over_unmerge_controls( op, rs ); - if ( pb->internal_op == 0 ) { + if ( pb->pb_intop == 0 ) { switch ( rs->sr_type ) { case REP_RESULT: rc = slapi_over_result( op, rs, SLAPI_PLUGIN_POST_RESULT_FN ); @@ -761,7 +761,7 @@ slapi_over_acl_group( if ( rc >= 0 ) /* 1 means no plugins called */ rc = SLAP_CB_CONTINUE; else - rc = 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 ); diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index 2bab678415..1f1e038f46 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -28,15 +28,15 @@ /* some parameters require a valid connection and operation */ #define PBLOCK_LOCK_CONN( _pb ) do { \ - ldap_pvt_thread_mutex_lock( &(_pb)->pconn->c_mutex ); \ + ldap_pvt_thread_mutex_lock( &(_pb)->pb_conn->c_mutex ); \ } while (0) #define PBLOCK_UNLOCK_CONN( _pb ) do { \ - ldap_pvt_thread_mutex_unlock( &(_pb)->pconn->c_mutex ); \ + ldap_pvt_thread_mutex_unlock( &(_pb)->pb_conn->c_mutex ); \ } while (0) /* some parameters are only settable for internal operations */ -#define PBLOCK_VALIDATE_IS_INTOP( _pb ) do { if ( (_pb)->internal_op == 0 ) break; } while ( 0 ) +#define PBLOCK_VALIDATE_IS_INTOP( _pb ) do { if ( (_pb)->pb_intop == 0 ) break; } while ( 0 ) static slapi_pblock_class_t pblock_get_param_class( int param ) @@ -289,13 +289,13 @@ pblock_get_param_class( int param ) static void pblock_lock( Slapi_PBlock *pb ) { - ldap_pvt_thread_mutex_lock(&pb->pblockMutex); + ldap_pvt_thread_mutex_lock(&pb->pb_mutex); } static void pblock_unlock( Slapi_PBlock *pb ) { - ldap_pvt_thread_mutex_unlock(&pb->pblockMutex); + ldap_pvt_thread_mutex_unlock(&pb->pb_mutex); } static int @@ -324,20 +324,20 @@ pblock_get_default( Slapi_PBlock *pb, int param, void **value ) return PBLOCK_ERROR; } - for ( i = 0; i < pb->numParams; i++ ) { - if ( pb->curParams[i] == param ) { + for ( i = 0; i < pb->pb_nParams; i++ ) { + if ( pb->pb_params[i] == param ) { switch ( pbClass ) { case PBLOCK_CLASS_INTEGER: - *((int *)value) = pb->curVals[i].pv_integer; + *((int *)value) = pb->pb_values[i].pv_integer; break; case PBLOCK_CLASS_LONG_INTEGER: - *((long *)value) = pb->curVals[i].pv_long_integer; + *((long *)value) = pb->pb_values[i].pv_long_integer; break; case PBLOCK_CLASS_POINTER: - *value = pb->curVals[i].pv_pointer; + *value = pb->pb_values[i].pv_pointer; break; case PBLOCK_CLASS_FUNCTION_POINTER: - *value = pb->curVals[i].pv_function_pointer; + *value = pb->pb_values[i].pv_function_pointer; break; default: break; @@ -387,35 +387,34 @@ pblock_set_default( Slapi_PBlock *pb, int param, void *value ) return PBLOCK_ERROR; } - if ( pb->numParams == PBLOCK_MAX_PARAMS ) { + if ( pb->pb_nParams == PBLOCK_MAX_PARAMS ) { return PBLOCK_ERROR; } - 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; - } + for ( i = 0; i < pb->pb_nParams; i++ ) { + if ( pb->pb_params[i] == param ) break; - } + } + if ( i >= pb->pb_nParams ) { + pb->pb_params[i] = param; + pb->pb_nParams++; } - if ( i >= pb->numParams ) { - pb->curParams[i] = param; - pb->numParams++; + switch ( pbClass ) { + case PBLOCK_CLASS_INTEGER: + pb->pb_values[i].pv_integer = (*((int *)value)); + break; + case PBLOCK_CLASS_LONG_INTEGER: + pb->pb_values[i].pv_long_integer = (*((long *)value)); + break; + case PBLOCK_CLASS_POINTER: + pb->pb_values[i].pv_pointer = value; + break; + case PBLOCK_CLASS_FUNCTION_POINTER: + pb->pb_values[i].pv_function_pointer = value; + break; + default: + break; } return PBLOCK_SUCCESS; @@ -430,75 +429,75 @@ pblock_get( Slapi_PBlock *pb, int param, void **value ) switch ( param ) { case SLAPI_OPERATION: - *value = pb->pop; + *value = pb->pb_op; break; case SLAPI_OPINITIATED_TIME: PBLOCK_ASSERT_OP( pb, 0 ); - *((long *)value) = pb->pop->o_time; + *((long *)value) = pb->pb_op->o_time; break; case SLAPI_OPERATION_ID: PBLOCK_ASSERT_OP( pb, 0 ); - *((long *)value) = pb->pop->o_opid; + *((long *)value) = pb->pb_op->o_opid; break; case SLAPI_OPERATION_TYPE: PBLOCK_ASSERT_OP( pb, 0 ); - *((ber_tag_t *)value) = pb->pop->o_tag; + *((ber_tag_t *)value) = pb->pb_op->o_tag; break; case SLAPI_REQCONTROLS: PBLOCK_ASSERT_OP( pb, 0 ); - *((LDAPControl ***)value) = pb->pop->o_ctrls; + *((LDAPControl ***)value) = pb->pb_op->o_ctrls; break; case SLAPI_REQUESTOR_DN: PBLOCK_ASSERT_OP( pb, 0 ); - *((char **)value) = pb->pop->o_ndn.bv_val; + *((char **)value) = pb->pb_op->o_ndn.bv_val; break; case SLAPI_MANAGEDSAIT: PBLOCK_ASSERT_OP( pb, 0 ); - *((int *)value) = get_manageDSAit( pb->pop ); + *((int *)value) = get_manageDSAit( pb->pb_op ); break; case SLAPI_BACKEND: PBLOCK_ASSERT_OP( pb, 0 ); - *((BackendDB **)value) = pb->pop->o_bd; + *((BackendDB **)value) = pb->pb_op->o_bd; break; case SLAPI_BE_TYPE: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_bd != NULL ) - *((char **)value) = pb->pop->o_bd->bd_info->bi_type; + if ( pb->pb_op->o_bd != NULL ) + *((char **)value) = pb->pb_op->o_bd->bd_info->bi_type; else *value = NULL; break; case SLAPI_CONNECTION: - *value = pb->pconn; + *value = pb->pb_conn; break; case SLAPI_X_CONN_SSF: PBLOCK_ASSERT_OP( pb, 0 ); - *((slap_ssf_t *)value) = pb->pconn->c_ssf; + *((slap_ssf_t *)value) = pb->pb_conn->c_ssf; break; case SLAPI_X_CONN_SASL_CONTEXT: PBLOCK_ASSERT_CONN( pb ); - if ( pb->pconn->c_sasl_authctx != NULL ) - *value = pb->pconn->c_sasl_authctx; + if ( pb->pb_conn->c_sasl_authctx != NULL ) + *value = pb->pb_conn->c_sasl_authctx; else - *value = pb->pconn->c_sasl_sockctx; + *value = pb->pb_conn->c_sasl_sockctx; break; case SLAPI_TARGET_DN: PBLOCK_ASSERT_OP( pb, 0 ); - *((char **)value) = pb->pop->o_req_ndn.bv_val; + *((char **)value) = pb->pb_op->o_req_ndn.bv_val; break; case SLAPI_REQUESTOR_ISROOT: PBLOCK_ASSERT_OP( pb, 0 ); - *((int *)value) = be_isroot( pb->pop ); + *((int *)value) = be_isroot( pb->pb_op ); break; case SLAPI_IS_REPLICATED_OPERATION: PBLOCK_ASSERT_OP( pb, 0 ); - *((int *)value) = be_isupdate( pb->pop ); + *((int *)value) = be_isupdate( pb->pb_op ); break; case SLAPI_CONN_AUTHTYPE: case SLAPI_CONN_AUTHMETHOD: /* XXX should return SASL mech */ PBLOCK_ASSERT_CONN( pb ); - *((char **)value) = pblock_get_authtype( &pb->pconn->c_authz, + *((char **)value) = pblock_get_authtype( &pb->pb_conn->c_authz, #ifdef HAVE_TLS - pb->pconn->c_is_tls + pb->pb_conn->c_is_tls #else 0 #endif @@ -507,61 +506,61 @@ pblock_get( Slapi_PBlock *pb, int param, void **value ) case SLAPI_X_CONN_IS_UDP: PBLOCK_ASSERT_CONN( pb ); #ifdef LDAP_CONNECTIONLESS - *((int *)value) = pb->pconn->c_is_udp; + *((int *)value) = pb->pb_conn->c_is_udp; #else *((int *)value) = 0; #endif break; case SLAPI_CONN_ID: PBLOCK_ASSERT_CONN( pb ); - *((long *)value) = pb->pconn->c_connid; + *((long *)value) = pb->pb_conn->c_connid; break; case SLAPI_CONN_DN: PBLOCK_ASSERT_CONN( pb ); - *((char **)value) = pb->pconn->c_dn.bv_val; + *((char **)value) = pb->pb_conn->c_dn.bv_val; break; case SLAPI_CONN_CLIENTIP: PBLOCK_ASSERT_CONN( pb ); - if ( strncmp( pb->pconn->c_peer_name.bv_val, "IP=", 3 ) == 0 ) - *((char **)value) = &pb->pconn->c_peer_name.bv_val[3]; + if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "IP=", 3 ) == 0 ) + *((char **)value) = &pb->pb_conn->c_peer_name.bv_val[3]; else *value = NULL; break; case SLAPI_X_CONN_CLIENTPATH: PBLOCK_ASSERT_CONN( pb ); - if ( strncmp( pb->pconn->c_peer_name.bv_val, "PATH=", 3 ) == 0 ) - *((char **)value) = &pb->pconn->c_peer_name.bv_val[5]; + if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "PATH=", 3 ) == 0 ) + *((char **)value) = &pb->pb_conn->c_peer_name.bv_val[5]; else *value = NULL; break; case SLAPI_CONN_SERVERIP: PBLOCK_ASSERT_CONN( pb ); - if ( strncmp( pb->pconn->c_peer_name.bv_val, "IP=", 3 ) == 0 ) - *((char **)value) = &pb->pconn->c_sock_name.bv_val[3]; + if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "IP=", 3 ) == 0 ) + *((char **)value) = &pb->pb_conn->c_sock_name.bv_val[3]; else *value = NULL; break; case SLAPI_X_CONN_SERVERPATH: PBLOCK_ASSERT_CONN( pb ); - if ( strncmp( pb->pconn->c_peer_name.bv_val, "PATH=", 3 ) == 0 ) - *((char **)value) = &pb->pconn->c_sock_name.bv_val[5]; + if ( strncmp( pb->pb_conn->c_peer_name.bv_val, "PATH=", 3 ) == 0 ) + *((char **)value) = &pb->pb_conn->c_sock_name.bv_val[5]; else *value = NULL; break; case SLAPI_RESULT_CODE: case SLAPI_PLUGIN_INTOP_RESULT: - *((int *)value) = pb->rs.sr_err; + *((int *)value) = pb->pb_rs.sr_err; break; case SLAPI_RESULT_TEXT: - *((const char **)value) = pb->rs.sr_text; + *((const char **)value) = pb->pb_rs.sr_text; break; case SLAPI_RESULT_MATCHED: - *((const char **)value) = pb->rs.sr_matched; + *((const char **)value) = pb->pb_rs.sr_matched; break; case SLAPI_ADD_ENTRY: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_ADD ) - *((Slapi_Entry **)value) = pb->pop->ora_e; + if ( pb->pb_op->o_tag == LDAP_REQ_ADD ) + *((Slapi_Entry **)value) = pb->pb_op->ora_e; else *value = NULL; break; @@ -569,12 +568,12 @@ pblock_get( Slapi_PBlock *pb, int param, void **value ) LDAPMod **mods = NULL; pblock_get_default( pb, param, (void **)&mods ); - if ( mods == NULL && pb->internal_op == 0 ) { - if ( pb->pop->o_tag != LDAP_REQ_MODIFY ) { + if ( mods == NULL && pb->pb_intop == 0 ) { + if ( pb->pb_op->o_tag != LDAP_REQ_MODIFY ) { rc = PBLOCK_ERROR; break; } - mods = slapi_int_modifications2ldapmods( &pb->pop->orm_modlist, NULL ); + mods = slapi_int_modifications2ldapmods( &pb->pb_op->orm_modlist, NULL ); pblock_set_default( pb, param, (void *)mods ); } *((LDAPMod ***)value) = mods; @@ -582,64 +581,64 @@ pblock_get( Slapi_PBlock *pb, int param, void **value ) } case SLAPI_MODRDN_NEWRDN: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_MODRDN ) - *((char **)value) = pb->pop->orr_newrdn.bv_val; + if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) + *((char **)value) = pb->pb_op->orr_newrdn.bv_val; else *value = NULL; break; case SLAPI_MODRDN_NEWSUPERIOR: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_MODRDN && pb->pop->orr_newSup != NULL ) - *((char **)value) = pb->pop->orr_newSup->bv_val; + if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN && pb->pb_op->orr_newSup != NULL ) + *((char **)value) = pb->pb_op->orr_newSup->bv_val; else *value = NULL; break; case SLAPI_MODRDN_DELOLDRDN: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_MODRDN ) - *((int *)value) = pb->pop->orr_deleteoldrdn; + if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) + *((int *)value) = pb->pb_op->orr_deleteoldrdn; else *((int *)value) = 0; break; case SLAPI_SEARCH_SCOPE: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((int *)value) = pb->pop->ors_scope; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((int *)value) = pb->pb_op->ors_scope; else *((int *)value) = 0; break; case SLAPI_SEARCH_DEREF: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((int *)value) = pb->pop->ors_deref; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((int *)value) = pb->pb_op->ors_deref; else *((int *)value) = 0; break; case SLAPI_SEARCH_SIZELIMIT: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((int *)value) = pb->pop->ors_slimit; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((int *)value) = pb->pb_op->ors_slimit; else *((int *)value) = 0; break; case SLAPI_SEARCH_TIMELIMIT: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((int *)value) = pb->pop->ors_tlimit; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((int *)value) = pb->pb_op->ors_tlimit; else *((int *)value) = 0; break; case SLAPI_SEARCH_FILTER: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((Slapi_Filter **)value) = pb->pop->ors_filter; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((Slapi_Filter **)value) = pb->pb_op->ors_filter; else *((Slapi_Filter **)value) = NULL; break; case SLAPI_SEARCH_STRFILTER: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((char **)value) = pb->pop->ors_filterstr.bv_val; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((char **)value) = pb->pb_op->ors_filterstr.bv_val; else *((char **)value) = NULL; break; @@ -647,69 +646,69 @@ pblock_get( Slapi_PBlock *pb, int param, void **value ) char **attrs = NULL; PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag != LDAP_REQ_SEARCH ) { + if ( pb->pb_op->o_tag != LDAP_REQ_SEARCH ) { rc = PBLOCK_ERROR; break; } pblock_get_default( pb, param, (void **)&attrs ); - if ( attrs == NULL && pb->internal_op == 0 ) { - attrs = anlist2charray_x( pb->pop->ors_attrs, 0, pb->pop->o_tmpmemctx ); + if ( attrs == NULL && pb->pb_intop == 0 ) { + attrs = anlist2charray_x( pb->pb_op->ors_attrs, 0, pb->pb_op->o_tmpmemctx ); pblock_set_default( pb, param, (void *)attrs ); } *((char ***)attrs) = attrs; } case SLAPI_SEARCH_ATTRSONLY: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - *((int *)value) = pb->pop->ors_attrsonly; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + *((int *)value) = pb->pb_op->ors_attrsonly; else *((int *)value) = 0; break; case SLAPI_SEARCH_RESULT_ENTRY: - *((Slapi_Entry **)value) = pb->rs.sr_entry; + *((Slapi_Entry **)value) = pb->pb_rs.sr_entry; break; case SLAPI_BIND_RET_SASLCREDS: - *((struct berval **)value) = pb->rs.sr_sasldata; + *((struct berval **)value) = pb->pb_rs.sr_sasldata; break; case SLAPI_EXT_OP_REQ_OID: - *((const char **)value) = pb->pop->ore_reqoid.bv_val; + *((const char **)value) = pb->pb_op->ore_reqoid.bv_val; break; case SLAPI_EXT_OP_REQ_VALUE: - *((struct berval **)value) = pb->pop->ore_reqdata; + *((struct berval **)value) = pb->pb_op->ore_reqdata; break; case SLAPI_EXT_OP_RET_OID: - *((const char **)value) = pb->rs.sr_rspoid; + *((const char **)value) = pb->pb_rs.sr_rspoid; break; case SLAPI_EXT_OP_RET_VALUE: - *((struct berval **)value) = pb->rs.sr_rspdata; + *((struct berval **)value) = pb->pb_rs.sr_rspdata; break; case SLAPI_BIND_METHOD: - if ( pb->pop->o_tag == LDAP_REQ_BIND ) - *((int *)value) = pb->pop->orb_method; + if ( pb->pb_op->o_tag == LDAP_REQ_BIND ) + *((int *)value) = pb->pb_op->orb_method; else *((int *)value) = 0; break; case SLAPI_BIND_CREDENTIALS: - if ( pb->pop->o_tag == LDAP_REQ_BIND ) - *((struct berval **)value) = &pb->pop->orb_cred; + if ( pb->pb_op->o_tag == LDAP_REQ_BIND ) + *((struct berval **)value) = &pb->pb_op->orb_cred; else *value = NULL; break; case SLAPI_COMPARE_TYPE: - if ( pb->pop->o_tag == LDAP_REQ_COMPARE ) - *((char **)value) = pb->pop->orc_ava->aa_desc->ad_cname.bv_val; + if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE ) + *((char **)value) = pb->pb_op->orc_ava->aa_desc->ad_cname.bv_val; else *value = NULL; break; case SLAPI_COMPARE_VALUE: - if ( pb->pop->o_tag == LDAP_REQ_COMPARE ) - *((struct berval **)value) = &pb->pop->orc_ava->aa_value; + if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE ) + *((struct berval **)value) = &pb->pb_op->orc_ava->aa_value; else *value = NULL; break; case SLAPI_ABANDON_MSGID: - if ( pb->pop->o_tag == LDAP_REQ_ABANDON ) - *((int *)value) = pb->pop->orn_msgid; + if ( pb->pb_op->o_tag == LDAP_REQ_ABANDON ) + *((int *)value) = pb->pb_op->orn_msgid; else *((int *)value) = 0; break; @@ -774,23 +773,23 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) switch ( param ) { case SLAPI_OPERATION: - pb->pop = (Operation *)value; + pb->pb_op = (Operation *)value; break; case SLAPI_OPINITIATED_TIME: PBLOCK_ASSERT_OP( pb, 0 ); - pb->pop->o_time = *((long *)value); + pb->pb_op->o_time = *((long *)value); break; case SLAPI_OPERATION_ID: PBLOCK_ASSERT_OP( pb, 0 ); - pb->pop->o_opid = *((long *)value); + pb->pb_op->o_opid = *((long *)value); break; case SLAPI_OPERATION_TYPE: PBLOCK_ASSERT_OP( pb, 0 ); - pb->pop->o_tag = *((ber_tag_t *)value); + pb->pb_op->o_tag = *((ber_tag_t *)value); break; case SLAPI_REQCONTROLS: PBLOCK_ASSERT_OP( pb, 0 ); - pb->pop->o_ctrls = (LDAPControl **)value; + pb->pb_op->o_ctrls = (LDAPControl **)value; break; case SLAPI_RESCONTROLS: { LDAPControl **ctrls = NULL; @@ -809,62 +808,62 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) break; case SLAPI_REQUESTOR_DN: PBLOCK_ASSERT_OP( pb, 0 ); - rc = pblock_set_dn( value, &pb->pop->o_dn, &pb->pop->o_ndn, pb->pop->o_tmpmemctx ); + rc = pblock_set_dn( value, &pb->pb_op->o_dn, &pb->pb_op->o_ndn, pb->pb_op->o_tmpmemctx ); break; case SLAPI_MANAGEDSAIT: PBLOCK_ASSERT_OP( pb, 0 ); - pb->pop->o_managedsait = *((int *)value); + pb->pb_op->o_managedsait = *((int *)value); break; case SLAPI_BACKEND: PBLOCK_ASSERT_OP( pb, 0 ); - pb->pop->o_bd = (BackendDB *)value; + pb->pb_op->o_bd = (BackendDB *)value; break; case SLAPI_CONNECTION: - pb->pconn = (Connection *)value; + pb->pb_conn = (Connection *)value; break; case SLAPI_X_CONN_SSF: PBLOCK_ASSERT_CONN( pb ); PBLOCK_LOCK_CONN( pb ); - pb->pconn->c_ssf = (slap_ssf_t)value; + pb->pb_conn->c_ssf = (slap_ssf_t)value; PBLOCK_UNLOCK_CONN( pb ); break; case SLAPI_X_CONN_SASL_CONTEXT: PBLOCK_ASSERT_CONN( pb ); PBLOCK_LOCK_CONN( pb ); - pb->pconn->c_sasl_authctx = value; + pb->pb_conn->c_sasl_authctx = value; PBLOCK_UNLOCK_CONN( pb ); break; case SLAPI_TARGET_DN: PBLOCK_ASSERT_OP( pb, 0 ); - rc = pblock_set_dn( value, &pb->pop->o_req_dn, &pb->pop->o_req_ndn, pb->pop->o_tmpmemctx ); + rc = pblock_set_dn( value, &pb->pb_op->o_req_dn, &pb->pb_op->o_req_ndn, pb->pb_op->o_tmpmemctx ); break; case SLAPI_CONN_ID: PBLOCK_ASSERT_CONN( pb ); PBLOCK_LOCK_CONN( pb ); - pb->pconn->c_connid = *((long *)value); + pb->pb_conn->c_connid = *((long *)value); PBLOCK_UNLOCK_CONN( pb ); break; case SLAPI_CONN_DN: PBLOCK_ASSERT_CONN( pb ); PBLOCK_LOCK_CONN( pb ); - rc = pblock_set_dn( value, &pb->pconn->c_dn, &pb->pconn->c_ndn, NULL ); + rc = pblock_set_dn( value, &pb->pb_conn->c_dn, &pb->pb_conn->c_ndn, NULL ); PBLOCK_UNLOCK_CONN( pb ); break; case SLAPI_RESULT_CODE: case SLAPI_PLUGIN_INTOP_RESULT: - pb->rs.sr_err = *((int *)value); + pb->pb_rs.sr_err = *((int *)value); break; case SLAPI_RESULT_TEXT: - snprintf( pb->textbuf, sizeof( pb->textbuf ), "%s", (char *)value ); - pb->rs.sr_text = pb->textbuf; + snprintf( pb->pb_textbuf, sizeof( pb->pb_textbuf ), "%s", (char *)value ); + pb->pb_rs.sr_text = pb->pb_textbuf; break; case SLAPI_RESULT_MATCHED: - pb->rs.sr_matched = (char *)value; /* XXX should dup? */ + pb->pb_rs.sr_matched = (char *)value; /* XXX should dup? */ break; case SLAPI_ADD_ENTRY: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_ADD ) { - pb->pop->ora_e = (Slapi_Entry *)value; + if ( pb->pb_op->o_tag == LDAP_REQ_ADD ) { + pb->pb_op->ora_e = (Slapi_Entry *)value; } else { rc = PBLOCK_ERROR; } @@ -878,16 +877,16 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) break; } - if ( pb->pop->o_tag == LDAP_REQ_MODIFY ) { - mlp = &pb->pop->orm_modlist; - } else if ( pb->pop->o_tag == LDAP_REQ_ADD ) { - mlp = &pb->pop->ora_modlist; + if ( pb->pb_op->o_tag == LDAP_REQ_MODIFY ) { + mlp = &pb->pb_op->orm_modlist; + } else if ( pb->pb_op->o_tag == LDAP_REQ_ADD ) { + mlp = &pb->pb_op->ora_modlist; } else { break; } if ( *mlp != NULL ) { - if ( pb->internal_op ) + if ( pb->pb_intop ) slapi_int_mods_free( *mlp ); /* caller owns values */ else slap_mods_free( *mlp ); /* we own values */ @@ -899,9 +898,9 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) case SLAPI_MODRDN_NEWRDN: PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_MODRDN ) { - rc = pblock_set_dn( value, &pb->pop->orr_newrdn, &pb->pop->orr_nnewrdn, pb->pop->o_tmpmemctx ); - if ( rc == LDAP_SUCCESS ) rc = rdn_validate( &pb->pop->orr_nnewrdn ); + if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) { + rc = pblock_set_dn( value, &pb->pb_op->orr_newrdn, &pb->pb_op->orr_nnewrdn, pb->pb_op->o_tmpmemctx ); + if ( rc == LDAP_SUCCESS ) rc = rdn_validate( &pb->pb_op->orr_nnewrdn ); } else { rc = PBLOCK_ERROR; } @@ -909,26 +908,26 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) case SLAPI_MODRDN_NEWSUPERIOR: PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_MODRDN ) { + if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) { if ( value == NULL ) { - if ( pb->pop->orr_newSup != NULL ) { - pb->pop->o_tmpfree( pb->pop->orr_newSup, pb->pop->o_tmpmemctx ); - pb->pop->orr_newSup = NULL; + if ( pb->pb_op->orr_newSup != NULL ) { + pb->pb_op->o_tmpfree( pb->pb_op->orr_newSup, pb->pb_op->o_tmpmemctx ); + pb->pb_op->orr_newSup = NULL; } - if ( pb->pop->orr_newSup != NULL ) { - pb->pop->o_tmpfree( pb->pop->orr_nnewSup, pb->pop->o_tmpmemctx ); - pb->pop->orr_nnewSup = NULL; + if ( pb->pb_op->orr_newSup != NULL ) { + pb->pb_op->o_tmpfree( pb->pb_op->orr_nnewSup, pb->pb_op->o_tmpmemctx ); + pb->pb_op->orr_nnewSup = NULL; } } else { - if ( pb->pop->orr_newSup == NULL ) { - pb->pop->orr_newSup = (struct berval *)pb->pop->o_tmpalloc( - sizeof(struct berval), pb->pop->o_tmpmemctx ); + if ( pb->pb_op->orr_newSup == NULL ) { + pb->pb_op->orr_newSup = (struct berval *)pb->pb_op->o_tmpalloc( + sizeof(struct berval), pb->pb_op->o_tmpmemctx ); } - if ( pb->pop->orr_nnewSup == NULL ) { - pb->pop->orr_nnewSup = (struct berval *)pb->pop->o_tmpalloc( - sizeof(struct berval), pb->pop->o_tmpmemctx ); + if ( pb->pb_op->orr_nnewSup == NULL ) { + pb->pb_op->orr_nnewSup = (struct berval *)pb->pb_op->o_tmpalloc( + sizeof(struct berval), pb->pb_op->o_tmpmemctx ); } - rc = pblock_set_dn( value, pb->pop->orr_newSup, pb->pop->orr_nnewSup, pb->pop->o_tmpmemctx ); + rc = pblock_set_dn( value, pb->pb_op->orr_newSup, pb->pb_op->orr_nnewSup, pb->pb_op->o_tmpmemctx ); } } else { rc = PBLOCK_ERROR; @@ -937,8 +936,8 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) case SLAPI_MODRDN_DELOLDRDN: PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_MODRDN ) - pb->pop->orr_deleteoldrdn = *((int *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_MODRDN ) + pb->pb_op->orr_deleteoldrdn = *((int *)value); else rc = PBLOCK_ERROR; break; @@ -946,7 +945,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) int scope = *((int *)value); PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) { + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) { switch ( *((int *)value) ) { case LDAP_SCOPE_BASE: case LDAP_SCOPE_ONELEVEL: @@ -954,7 +953,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) #ifdef LDAP_SCOPE_SUBORDINATE case LDAP_SCOPE_SUBORDINATE: #endif - pb->pop->ors_scope = scope; + pb->pb_op->ors_scope = scope; break; default: rc = PBLOCK_ERROR; @@ -967,37 +966,37 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) } case SLAPI_SEARCH_DEREF: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - pb->pop->ors_deref = *((int *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + pb->pb_op->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); + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + pb->pb_op->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); + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + pb->pb_op->ors_tlimit = *((int *)value); else rc = PBLOCK_ERROR; break; case SLAPI_SEARCH_FILTER: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - pb->pop->ors_filter = (Slapi_Filter *)value; + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + pb->pb_op->ors_filter = (Slapi_Filter *)value; else rc = PBLOCK_ERROR; break; case SLAPI_SEARCH_STRFILTER: PBLOCK_ASSERT_OP( pb, 0 ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) { - pb->pop->ors_filterstr.bv_val = (char *)value; - pb->pop->ors_filterstr.bv_len = strlen((char *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) { + pb->pb_op->ors_filterstr.bv_val = (char *)value; + pb->pb_op->ors_filterstr.bv_len = strlen((char *)value); } else { rc = PBLOCK_ERROR; } @@ -1010,7 +1009,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag != LDAP_REQ_SEARCH ) { + if ( pb->pb_op->o_tag != LDAP_REQ_SEARCH ) { rc = PBLOCK_ERROR; break; } @@ -1019,54 +1018,54 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) if ( rc != PBLOCK_SUCCESS ) { break; } - if ( pb->pop->ors_attrs != NULL ) { - pb->pop->o_tmpfree( pb->pop->ors_attrs, pb->pop->o_tmpmemctx ); - pb->pop->ors_attrs = NULL; + if ( pb->pb_op->ors_attrs != NULL ) { + pb->pb_op->o_tmpfree( pb->pb_op->ors_attrs, pb->pb_op->o_tmpmemctx ); + pb->pb_op->ors_attrs = NULL; } if ( attrs != NULL ) { for ( i = 0; attrs[i] != NULL; i++ ) ; } if ( i ) { - an = (AttributeName *)pb->pop->o_tmpalloc( (i + 1) * - sizeof(AttributeName), pb->pop->o_tmpmemctx ); + an = (AttributeName *)pb->pb_op->o_tmpalloc( (i + 1) * + sizeof(AttributeName), pb->pb_op->o_tmpmemctx ); for ( i = 0; attrs[i] != NULL; i++ ) { an[i].an_desc = NULL; an[i].an_oc = NULL; 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->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; } - pb->pop->ors_attrs = an; + pb->pb_op->ors_attrs = an; break; } case SLAPI_SEARCH_ATTRSONLY: PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) - pb->pop->ors_attrsonly = *((int *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) + pb->pb_op->ors_attrsonly = *((int *)value); else rc = PBLOCK_ERROR; break; case SLAPI_SEARCH_RESULT_ENTRY: PBLOCK_ASSERT_OP( pb, 0 ); - pb->rs.sr_entry = (Slapi_Entry *)value; + pb->pb_rs.sr_entry = (Slapi_Entry *)value; break; case SLAPI_BIND_RET_SASLCREDS: - pb->rs.sr_sasldata = (struct berval *)value; + pb->pb_rs.sr_sasldata = (struct berval *)value; break; case SLAPI_EXT_OP_REQ_OID: PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_EXTENDED ) { - pb->pop->ore_reqoid.bv_val = (char *)value; - pb->pop->ore_reqoid.bv_len = strlen((char *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_EXTENDED ) { + pb->pb_op->ore_reqoid.bv_val = (char *)value; + pb->pb_op->ore_reqoid.bv_len = strlen((char *)value); } else { rc = PBLOCK_ERROR; } @@ -1075,23 +1074,23 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_EXTENDED ) - pb->pop->ore_reqdata = (struct berval *)value; + if ( pb->pb_op->o_tag == LDAP_REQ_EXTENDED ) + pb->pb_op->ore_reqdata = (struct berval *)value; else rc = PBLOCK_ERROR; break; case SLAPI_EXT_OP_RET_OID: - pb->rs.sr_rspoid = (char *)value; + pb->pb_rs.sr_rspoid = (char *)value; break; case SLAPI_EXT_OP_RET_VALUE: - pb->rs.sr_rspdata = (struct berval *)value; + pb->pb_rs.sr_rspdata = (struct berval *)value; break; case SLAPI_BIND_METHOD: PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_BIND ) - pb->pop->orb_method = *((int *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_BIND ) + pb->pb_op->orb_method = *((int *)value); else rc = PBLOCK_ERROR; break; @@ -1099,8 +1098,8 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_BIND ) - pb->pop->orb_cred = *((struct berval *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_BIND ) + pb->pb_op->orb_cred = *((struct berval *)value); else rc = PBLOCK_ERROR; break; @@ -1108,11 +1107,11 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_COMPARE ) { + if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE ) { const char *text; - pb->pop->orc_ava->aa_desc = NULL; - rc = slap_str2ad( (char *)value, &pb->pop->orc_ava->aa_desc, &text ); + pb->pb_op->orc_ava->aa_desc = NULL; + rc = slap_str2ad( (char *)value, &pb->pb_op->orc_ava->aa_desc, &text ); } else { rc = PBLOCK_ERROR; } @@ -1121,8 +1120,8 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_COMPARE ) - pb->pop->orc_ava->aa_value = *((struct berval *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_COMPARE ) + pb->pb_op->orc_ava->aa_value = *((struct berval *)value); else rc = PBLOCK_ERROR; break; @@ -1130,8 +1129,8 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) PBLOCK_ASSERT_OP( pb, 0 ); PBLOCK_VALIDATE_IS_INTOP( pb ); - if ( pb->pop->o_tag == LDAP_REQ_ABANDON) - pb->pop->orn_msgid = *((int *)value); + if ( pb->pb_op->o_tag == LDAP_REQ_ABANDON) + pb->pb_op->orn_msgid = *((int *)value); else rc = PBLOCK_ERROR; break; @@ -1160,7 +1159,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value ) static void pblock_clear( Slapi_PBlock *pb ) { - pb->numParams = 1; + pb->pb_nParams = 1; } static int @@ -1170,23 +1169,23 @@ pblock_delete_param( Slapi_PBlock *p, int param ) pblock_lock(p); - for ( i = 0; i < p->numParams; i++ ) { - if ( p->curParams[i] == param ) { + for ( i = 0; i < p->pb_nParams; i++ ) { + if ( p->pb_params[i] == param ) { break; } } - if (i >= p->numParams ) { + if (i >= p->pb_nParams ) { pblock_unlock( p ); return PBLOCK_ERROR; } /* move last parameter to index of deleted parameter */ - if ( p->numParams > 1 ) { - p->curParams[i] = p->curParams[p->numParams - 1]; - p->curVals[i] = p->curVals[p->numParams - 1]; + if ( p->pb_nParams > 1 ) { + p->pb_params[i] = p->pb_params[p->pb_nParams - 1]; + p->pb_values[i] = p->pb_values[p->pb_nParams - 1]; } - p->numParams--; + p->pb_nParams--; pblock_unlock( p ); @@ -1200,15 +1199,14 @@ slapi_pblock_new(void) pb = (Slapi_PBlock *) ch_calloc( 1, sizeof(Slapi_PBlock) ); if ( pb != NULL ) { - ldap_pvt_thread_mutex_init( &pb->pblockMutex ); - memset( pb->curParams, 0, sizeof(pb->curParams) ); - memset( pb->curVals, 0, sizeof(pb->curVals) ); - pb->curParams[0] = SLAPI_IBM_PBLOCK; - pb->curVals[0].pv_pointer = NULL; - pb->numParams = 1; - pb->pconn = NULL; - pb->pop = NULL; - pb->internal_op = 0; + ldap_pvt_thread_mutex_init( &pb->pb_mutex ); + + pb->pb_params[0] = SLAPI_IBM_PBLOCK; + pb->pb_values[0].pv_pointer = NULL; + pb->pb_nParams = 1; + pb->pb_conn = NULL; + pb->pb_op = NULL; + pb->pb_intop = 0; } return pb; } @@ -1227,7 +1225,7 @@ pblock_destroy( Slapi_PBlock *pb ) ldap_controls_free( controls ); } - if ( pb->internal_op ) { + if ( pb->pb_intop ) { slapi_int_connection_done_pb( pb ); } else { pblock_get_default( pb, SLAPI_MODIFY_MODS, (void **)&mods ); @@ -1236,10 +1234,10 @@ pblock_destroy( Slapi_PBlock *pb ) pblock_get_default( pb, SLAPI_SEARCH_ATTRS, (void **)&attrs ); if ( attrs != NULL ) - pb->pop->o_tmpfree( attrs, pb->pop->o_tmpmemctx ); + pb->pb_op->o_tmpfree( attrs, pb->pb_op->o_tmpmemctx ); } - ldap_pvt_thread_mutex_destroy( &pb->pblockMutex ); + ldap_pvt_thread_mutex_destroy( &pb->pb_mutex ); slapi_ch_free( (void **)&pb ); } diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index c9ccbd6dc1..1516343275 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -462,9 +462,9 @@ slapi_entry_has_children( const Slapi_Entry *e ) slapi_pblock_set( pb, SLAPI_TARGET_DN, slapi_entry_get_dn( (Entry *)e ) ); - pb->pop->o_bd = select_backend( (struct berval *)&e->e_nname, 0, 0 ); - if ( pb->pop->o_bd != NULL ) { - pb->pop->o_bd->be_has_subordinates( pb->pop, (Entry *)e, &hasSubordinates ); + pb->pb_op->o_bd = select_backend( (struct berval *)&e->e_nname, 0, 0 ); + if ( pb->pb_op->o_bd != NULL ) { + pb->pb_op->o_bd->be_has_subordinates( pb->pb_op, (Entry *)e, &hasSubordinates ); } slapi_pblock_destroy( pb ); @@ -591,7 +591,7 @@ slapi_entry_delete_values( Slapi_Entry *e, const char *type, struct berval **val } if ( vals[0] == NULL ) { - /* SLAPI doco says LDAP_OPERATIONS_ERROR but LDAP_OTHER is better */ + /* SLAPI doco says LDApb_opERATIONS_ERROR but LDAP_OTHER is better */ return attr_delete( &e->e_attrs, mod.sm_desc ) ? LDAP_OTHER : LDAP_SUCCESS; } @@ -925,10 +925,10 @@ char *slapi_dn_beparent( Slapi_PBlock *pb, const char *_dn ) struct berval dn, prettyDN; struct berval normalizedDN, parentDN; - if ( pb == NULL || pb->pop == NULL ) + if ( pb == NULL || pb->pb_op == NULL ) return NULL; - be = pb->pop->o_bd; + be = pb->pb_op->o_bd; dn.bv_val = (char *)_dn; dn.bv_len = strlen( _dn ); @@ -1297,9 +1297,9 @@ slapi_send_ldap_result( { SlapReply *rs; - assert( pb->pop != NULL ); + assert( pb->pb_op != NULL ); - rs = &pb->rs; + rs = &pb->pb_rs; rs->sr_err = err; rs->sr_matched = matched; @@ -1307,14 +1307,14 @@ slapi_send_ldap_result( rs->sr_ref = NULL; if ( err == LDAP_SASL_BIND_IN_PROGRESS ) { - send_ldap_sasl( pb->pop, rs ); + send_ldap_sasl( pb->pb_op, rs ); } else if ( rs->sr_rspoid != NULL ) { - send_ldap_extended( pb->pop, rs ); + send_ldap_extended( pb->pb_op, rs ); } else { - if ( pb->pop->o_tag == LDAP_REQ_SEARCH ) + if ( pb->pb_op->o_tag == LDAP_REQ_SEARCH ) rs->sr_nentries = nentries; - send_ldap_result( pb->pop, rs ); + send_ldap_result( pb->pb_op, rs ); } } @@ -1332,7 +1332,7 @@ slapi_send_ldap_search_entry( const char *text; int rc; - assert( pb->pop != NULL ); + assert( pb->pb_op != NULL ); if ( attrs != NULL ) { for ( i = 0; attrs[ i ] != NULL; i++ ) { @@ -1367,7 +1367,7 @@ slapi_send_ldap_search_entry( rs.sr_v2ref = NULL; rs.sr_flags = 0; - rc = send_search_entry( pb->pop, &rs ); + rc = send_search_entry( pb->pb_op, &rs ); slapi_ch_free( (void **)&an ); @@ -1410,7 +1410,7 @@ slapi_send_ldap_search_reference( rs.sr_v2ref = NULL; } - rc = send_search_reference( pb->pop, &rs ); + rc = send_search_reference( pb->pb_op, &rs ); slapi_ch_free( (void **)&rs.sr_ref ); slapi_ch_free( (void **)&rs.sr_v2ref ); @@ -1762,7 +1762,7 @@ slapi_filter_test( Slapi_PBlock *pb, Slapi_Entry *e, Slapi_Filter *f, } if ( verify_access ) { - op = pb->pop; + op = pb->pb_op; if ( op == NULL ) return LDAP_PARAM_ERROR; } else { @@ -2008,11 +2008,11 @@ int slapi_is_connection_ssl( Slapi_PBlock *pb, int *isSSL ) if ( pb == NULL ) return LDAP_PARAM_ERROR; - if ( pb->pconn == NULL ) + if ( pb->pb_conn == NULL ) return LDAP_PARAM_ERROR; #ifdef HAVE_TLS - *isSSL = pb->pconn->c_is_tls; + *isSSL = pb->pb_conn->c_is_tls; #else *isSSL = 0; #endif @@ -2618,9 +2618,9 @@ int slapi_access_allowed( Slapi_PBlock *pb, Slapi_Entry *e, char *attr, break; } - assert( pb->pop != NULL ); + assert( pb->pb_op != NULL ); - if ( access_allowed( pb->pop, e, ad, val, slap_access, NULL ) ) { + if ( access_allowed( pb->pb_op, e, ad, val, slap_access, NULL ) ) { return LDAP_SUCCESS; } @@ -2632,7 +2632,7 @@ int slapi_acl_check_mods(Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char int rc = LDAP_SUCCESS; Modifications *ml; - if ( pb == NULL || pb->pop == NULL ) + if ( pb == NULL || pb->pb_op == NULL ) return LDAP_PARAM_ERROR; ml = slapi_int_ldapmods2modifications( mods, NULL ); @@ -2641,7 +2641,7 @@ int slapi_acl_check_mods(Slapi_PBlock *pb, Slapi_Entry *e, LDAPMod **mods, char } if ( rc == LDAP_SUCCESS ) { - rc = acl_check_modlist( pb->pop, e, ml ) ? LDAP_SUCCESS : LDAP_INSUFFICIENT_ACCESS; + rc = acl_check_modlist( pb->pb_op, e, ml ) ? LDAP_SUCCESS : LDAP_INSUFFICIENT_ACCESS; } /* Careful when freeing the modlist because it has pointers into the mods array. */ @@ -2970,10 +2970,10 @@ int compute_evaluator(computed_attr_context *c, char *type, Slapi_Entry *e, slap int compute_rewrite_search_filter( Slapi_PBlock *pb ) { - if ( pb == NULL || pb->pop == NULL ) + if ( pb == NULL || pb->pb_op == NULL ) return LDAP_PARAM_ERROR; - return slapi_int_call_plugins( pb->pop->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, pb ); + return slapi_int_call_plugins( pb->pb_op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, pb ); } /* -- 2.39.5