mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-01 04:29:35 -05:00
Workaround for SLAPI impedence mismatch with new thread-local malloc;
computed search rewriter plugins cannot use thread-local malloc
This commit is contained in:
parent
423ad06fa6
commit
0e46e4a7af
1 changed files with 23 additions and 8 deletions
|
|
@ -472,21 +472,36 @@ static int doPreSearchPluginFNs( Operation *op )
|
|||
static int doSearchRewriteFNs( Operation *op )
|
||||
{
|
||||
if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, op->o_pb ) == 0 ) {
|
||||
Filter *f;
|
||||
|
||||
/*
|
||||
* The plugin can set the SLAPI_SEARCH_FILTER.
|
||||
* SLAPI_SEARCH_STRFILER is not normative.
|
||||
*/
|
||||
slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter);
|
||||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
|
||||
slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&f );
|
||||
if ( f != op->ors_filter ) {
|
||||
/* Plugin modified filter. Is pointer comparison safe? */
|
||||
/*
|
||||
* This is inefficient but it is not possible to expose the
|
||||
* new memory allocation API through SLAPI.
|
||||
*
|
||||
* Further, the plugin should be responsible for freeing
|
||||
* the original filter, but there is no way to communicate
|
||||
* the memory context through the SLAPI filter free API.
|
||||
*/
|
||||
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
|
||||
filter2bv_x( op, f, &op->ors_filterstr );
|
||||
filter_free_x( op, op->ors_filter );
|
||||
op->ors_filter = str2filter_x( op, op->ors_filterstr.bv_val );
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ARGS,
|
||||
"doSearchRewriteFNs: after compute_rewrite_search filter: %s\n",
|
||||
op->ors_filterstr.bv_len ? op->ors_filterstr.bv_val : "empty", 0, 0 );
|
||||
LDAP_LOG( OPERATION, ARGS,
|
||||
"doSearchRewriteFNs: after compute_rewrite_search filter: %s\n",
|
||||
op->ors_filterstr.bv_len ? op->ors_filterstr.bv_val : "empty", 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_ARGS, " after compute_rewrite_search filter: %s\n",
|
||||
op->ors_filterstr.bv_len ? op->ors_filterstr.bv_val : "empty", 0, 0 );
|
||||
Debug( LDAP_DEBUG_ARGS, " after compute_rewrite_search filter: %s\n",
|
||||
op->ors_filterstr.bv_len ? op->ors_filterstr.bv_val : "empty", 0, 0 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return LDAP_SUCCESS;
|
||||
|
|
|
|||
Loading…
Reference in a new issue