mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
Minor cleanups
This commit is contained in:
parent
ebecca7379
commit
f897519d11
@ -18,7 +18,12 @@
|
||||
|
||||
#include "slap.h"
|
||||
|
||||
#ifndef CSRIMALLOC
|
||||
BerMemoryFunctions ch_mfuncs = {
|
||||
(BER_MEMALLOC_FN *)ch_malloc,
|
||||
(BER_MEMCALLOC_FN *)ch_calloc,
|
||||
(BER_MEMREALLOC_FN *)ch_realloc,
|
||||
(BER_MEMFREE_FN *)ch_free
|
||||
};
|
||||
|
||||
void *
|
||||
ch_malloc(
|
||||
@ -27,7 +32,7 @@ ch_malloc(
|
||||
{
|
||||
void *new;
|
||||
|
||||
if ( (new = (void *) ber_memalloc( size )) == NULL ) {
|
||||
if ( (new = (void *) ber_memalloc_x( size, NULL )) == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR,
|
||||
"ch_malloc: allocation of %lu bytes failed\n", (long)size, 0,0 );
|
||||
@ -58,7 +63,7 @@ ch_realloc(
|
||||
ch_free( block );
|
||||
}
|
||||
|
||||
if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
|
||||
if ( (new = (void *) ber_memrealloc_x( block, size, NULL )) == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR,
|
||||
"ch_realloc: reallocation of %lu bytes failed\n", (long)size, 0,0 );
|
||||
@ -81,7 +86,7 @@ ch_calloc(
|
||||
{
|
||||
void *new;
|
||||
|
||||
if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
|
||||
if ( (new = (void *) ber_memcalloc_x( nelem, size, NULL )) == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR,
|
||||
"ch_calloc: allocation of %lu elements of %lu bytes faild\n",
|
||||
@ -104,7 +109,7 @@ ch_strdup(
|
||||
{
|
||||
char *new;
|
||||
|
||||
if ( (new = ber_strdup( string )) == NULL ) {
|
||||
if ( (new = ber_strdup_x( string, NULL )) == NULL ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ERR,
|
||||
"chr_strdup: duplication of \"%s\" failed\n", string, 0, 0 );
|
||||
@ -121,7 +126,6 @@ ch_strdup(
|
||||
void
|
||||
ch_free( void *ptr )
|
||||
{
|
||||
ber_memfree( ptr );
|
||||
ber_memfree_x( ptr, NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -919,12 +919,10 @@ connection_operation( void *ctx, void *arg_v )
|
||||
memctx = sl_mem_create( SLAB_SIZE, ctx );
|
||||
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, memctx );
|
||||
op->o_tmpmemctx = memctx;
|
||||
op->o_tmpalloc = sl_malloc;
|
||||
op->o_tmpfree = sl_free;
|
||||
op->o_tmpmfuncs = &sl_mfuncs;
|
||||
} else {
|
||||
op->o_tmpmemctx = NULL;
|
||||
op->o_tmpalloc = (BER_MEMALLOC_FN *)ch_malloc;
|
||||
op->o_tmpfree = (BER_MEMFREE_FN *)ch_free;
|
||||
op->o_tmpmfuncs = &ch_mfuncs;
|
||||
}
|
||||
|
||||
switch ( tag ) {
|
||||
|
@ -351,9 +351,6 @@ int get_ctrls(
|
||||
BerElement *ber = op->o_ber;
|
||||
struct slap_control *sc;
|
||||
struct berval bv;
|
||||
BER_MEMREALLOC_FN *reallo;
|
||||
|
||||
reallo = op->o_tmpmemctx ? sl_realloc : (BER_MEMREALLOC_FN *)ch_realloc;
|
||||
|
||||
len = ber_pvt_ber_remaining(ber);
|
||||
|
||||
@ -413,7 +410,7 @@ int get_ctrls(
|
||||
/* allocate pointer space for current controls (nctrls)
|
||||
* + this control + extra NULL
|
||||
*/
|
||||
tctrls = reallo( op->o_ctrls,
|
||||
tctrls = op->o_tmprealloc( op->o_ctrls,
|
||||
(nctrls+2) * sizeof(LDAPControl *), op->o_tmpmemctx );
|
||||
|
||||
#if 0
|
||||
|
@ -615,85 +615,83 @@ filter_free( Filter *f )
|
||||
Operation op;
|
||||
|
||||
op.o_tmpmemctx = NULL;
|
||||
op.o_tmpfree = (BER_MEMFREE_FN *)ch_free;
|
||||
op.o_tmpmfuncs = &ch_mfuncs;
|
||||
filter_free_x( &op, f );
|
||||
}
|
||||
|
||||
void
|
||||
filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
filter2bv_x( Operation *op, Filter *f, struct berval *fstr )
|
||||
{
|
||||
int i;
|
||||
Filter *p;
|
||||
struct berval tmp;
|
||||
ber_len_t len;
|
||||
BER_MEMALLOC_FN *alloc = ctx ? sl_malloc : (BER_MEMALLOC_FN *)ch_malloc;
|
||||
BER_MEMREALLOC_FN *reallo = ctx ? sl_realloc : (BER_MEMREALLOC_FN *)ch_realloc;
|
||||
|
||||
if ( f == NULL ) {
|
||||
ber_str2bv_x( "No filter!", sizeof("No filter!")-1, 1, fstr, ctx );
|
||||
ber_str2bv_x( "No filter!", sizeof("No filter!")-1, 1, fstr, op->o_tmpmemctx );
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( f->f_choice ) {
|
||||
case LDAP_FILTER_EQUALITY:
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
|
||||
tmp.bv_len + ( sizeof("(=)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
|
||||
f->f_av_desc->ad_cname.bv_val,
|
||||
tmp.bv_val );
|
||||
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_GE:
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
|
||||
tmp.bv_len + ( sizeof("(>=)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
|
||||
f->f_av_desc->ad_cname.bv_val,
|
||||
tmp.bv_val );
|
||||
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_LE:
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
|
||||
tmp.bv_len + ( sizeof("(<=)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
|
||||
f->f_av_desc->ad_cname.bv_val,
|
||||
tmp.bv_val );
|
||||
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_APPROX:
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_av_value, &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
|
||||
tmp.bv_len + ( sizeof("(~=)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
|
||||
f->f_av_desc->ad_cname.bv_val,
|
||||
tmp.bv_val );
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_SUBSTRINGS:
|
||||
fstr->bv_len = f->f_sub_desc->ad_cname.bv_len +
|
||||
( sizeof("(=*)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 128, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 128, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
|
||||
f->f_sub_desc->ad_cname.bv_val );
|
||||
@ -701,46 +699,46 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
if ( f->f_sub_initial.bv_val != NULL ) {
|
||||
len = fstr->bv_len;
|
||||
|
||||
filter_escape_value_x( &f->f_sub_initial, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_sub_initial, &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len += tmp.bv_len;
|
||||
fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( &fstr->bv_val[len-2], tmp.bv_len+3,
|
||||
/* "(attr=" */ "%s*)",
|
||||
tmp.bv_val );
|
||||
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
if ( f->f_sub_any != NULL ) {
|
||||
for ( i = 0; f->f_sub_any[i].bv_val != NULL; i++ ) {
|
||||
len = fstr->bv_len;
|
||||
filter_escape_value_x( &f->f_sub_any[i], &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_sub_any[i], &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len += tmp.bv_len + 1;
|
||||
fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( &fstr->bv_val[len-1], tmp.bv_len+3,
|
||||
/* "(attr=[init]*[any*]" */ "%s*)",
|
||||
tmp.bv_val );
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
}
|
||||
}
|
||||
|
||||
if ( f->f_sub_final.bv_val != NULL ) {
|
||||
len = fstr->bv_len;
|
||||
|
||||
filter_escape_value_x( &f->f_sub_final, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_sub_final, &tmp, op->o_tmpmemctx );
|
||||
|
||||
fstr->bv_len += tmp.bv_len;
|
||||
fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( &fstr->bv_val[len-1], tmp.bv_len+3,
|
||||
/* "(attr=[init*][any*]" */ "%s)",
|
||||
tmp.bv_val );
|
||||
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
break;
|
||||
@ -748,7 +746,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
case LDAP_FILTER_PRESENT:
|
||||
fstr->bv_len = f->f_desc->ad_cname.bv_len +
|
||||
( sizeof("(=*)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
|
||||
f->f_desc->ad_cname.bv_val );
|
||||
@ -758,7 +756,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
case LDAP_FILTER_OR:
|
||||
case LDAP_FILTER_NOT:
|
||||
fstr->bv_len = sizeof("(%)") - 1;
|
||||
fstr->bv_val = alloc( fstr->bv_len + 128, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 128, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%c)",
|
||||
f->f_choice == LDAP_FILTER_AND ? '&' :
|
||||
@ -767,22 +765,22 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
for ( p = f->f_list; p != NULL; p = p->f_next ) {
|
||||
len = fstr->bv_len;
|
||||
|
||||
filter2bv( p, &tmp );
|
||||
filter2bv_x( op, p, &tmp );
|
||||
|
||||
fstr->bv_len += tmp.bv_len;
|
||||
fstr->bv_val = reallo( fstr->bv_val, fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( &fstr->bv_val[len-1], tmp.bv_len + 2,
|
||||
/*"("*/ "%s)", tmp.bv_val );
|
||||
|
||||
ch_free( tmp.bv_val );
|
||||
op->o_tmpfree( tmp.bv_val, op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case LDAP_FILTER_EXT: {
|
||||
struct berval ad;
|
||||
filter_escape_value_x( &f->f_mr_value, &tmp, ctx );
|
||||
filter_escape_value_x( &f->f_mr_value, &tmp, op->o_tmpmemctx );
|
||||
|
||||
if ( f->f_mr_desc ) {
|
||||
ad = f->f_mr_desc->ad_cname;
|
||||
@ -795,7 +793,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
|
||||
( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +
|
||||
tmp.bv_len + ( sizeof("(:=)") - 1 );
|
||||
fstr->bv_val = alloc( fstr->bv_len + 1, ctx );
|
||||
fstr->bv_val = op->o_tmpalloc( fstr->bv_len + 1, op->o_tmpmemctx );
|
||||
|
||||
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
|
||||
ad.bv_val,
|
||||
@ -803,7 +801,7 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
f->f_mr_rule_text.bv_len ? ":" : "",
|
||||
f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : "",
|
||||
tmp.bv_val );
|
||||
ber_memfree_x( tmp.bv_val, ctx );
|
||||
ber_memfree_x( tmp.bv_val, op->o_tmpmemctx );
|
||||
} break;
|
||||
|
||||
case SLAPD_FILTER_COMPUTED:
|
||||
@ -816,11 +814,11 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
f->f_result == LDAP_COMPARE_TRUE ? sizeof("(?=true)")-1 :
|
||||
f->f_result == SLAPD_COMPARE_UNDEFINED ? sizeof("(?=undefined)")-1 :
|
||||
sizeof("(?=error)")-1,
|
||||
1, fstr, ctx );
|
||||
1, fstr, op->o_tmpmemctx );
|
||||
break;
|
||||
|
||||
default:
|
||||
ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1, 1, fstr, ctx );
|
||||
ber_str2bv_x( "(?=unknown)", sizeof("(?=unknown)")-1, 1, fstr, op->o_tmpmemctx );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -828,7 +826,11 @@ filter2bv_x( Filter *f, struct berval *fstr, void *ctx )
|
||||
void
|
||||
filter2bv( Filter *f, struct berval *fstr )
|
||||
{
|
||||
filter2bv_x( f, fstr, NULL );
|
||||
Operation op;
|
||||
op.o_tmpmemctx = NULL;
|
||||
op.o_tmpmfuncs = &ch_mfuncs;
|
||||
|
||||
filter2bv_x( &op, f, fstr );
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -256,14 +256,7 @@ LDAP_SLAPD_F (int) glue_sub_init( void );
|
||||
/*
|
||||
* ch_malloc.c
|
||||
*/
|
||||
#ifdef CSRIMALLOC
|
||||
#define ch_malloc malloc
|
||||
#define ch_realloc realloc
|
||||
#define ch_calloc calloc
|
||||
#define ch_strdup strdup
|
||||
#define ch_free free
|
||||
|
||||
#else
|
||||
LDAP_SLAPD_V (BerMemoryFunctions) ch_mfuncs;
|
||||
LDAP_SLAPD_F (void *) ch_malloc LDAP_P(( ber_len_t size ));
|
||||
LDAP_SLAPD_F (void *) ch_realloc LDAP_P(( void *block, ber_len_t size ));
|
||||
LDAP_SLAPD_F (void *) ch_calloc LDAP_P(( ber_len_t nelem, ber_len_t size ));
|
||||
@ -274,7 +267,6 @@ LDAP_SLAPD_F (void) ch_free LDAP_P(( void * ));
|
||||
#undef free
|
||||
#define free ch_free
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* controls.c
|
||||
@ -498,7 +490,7 @@ LDAP_SLAPD_F (int) get_filter LDAP_P((
|
||||
LDAP_SLAPD_F (void) filter_free LDAP_P(( Filter *f ));
|
||||
LDAP_SLAPD_F (void) filter_free_x LDAP_P(( Operation *op, Filter *f ));
|
||||
LDAP_SLAPD_F (void) filter2bv LDAP_P(( Filter *f, struct berval *bv ));
|
||||
LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Filter *f, struct berval *bv, void *ctx ));
|
||||
LDAP_SLAPD_F (void) filter2bv_x LDAP_P(( Operation *op, Filter *f, struct berval *bv ));
|
||||
|
||||
LDAP_SLAPD_F (int) get_vrFilter LDAP_P(( Operation *op, BerElement *ber,
|
||||
ValuesReturnFilter **f,
|
||||
@ -970,10 +962,12 @@ LDAP_SLAPD_F (int) dscompare LDAP_P(( const char *s1, const char *s2del,
|
||||
/*
|
||||
* sl_malloc.c
|
||||
*/
|
||||
LDAP_SLAPD_V (BerMemoryFunctions) sl_mfuncs;
|
||||
LDAP_SLAPD_F (void *) sl_malloc LDAP_P(( ber_len_t size, void *ctx ));
|
||||
LDAP_SLAPD_F (void *) sl_realloc LDAP_P(( void *block, ber_len_t size, void *ctx ));
|
||||
LDAP_SLAPD_F (void *) sl_calloc LDAP_P(( ber_len_t nelem, ber_len_t size, void *ctx ));
|
||||
LDAP_SLAPD_F (void) sl_free LDAP_P(( void *, void *ctx ));
|
||||
LDAP_SLAPD_F (void *) sl_mem_create LDAP_P(( ber_len_t size, void *ctx ));
|
||||
|
||||
/*
|
||||
* starttls.c
|
||||
|
@ -439,8 +439,7 @@ slap_auxprop_lookup(
|
||||
op.o_is_auth_check = 1;
|
||||
op.o_threadctx = conn->c_sasl_bindop->o_threadctx;
|
||||
op.o_tmpmemctx = conn->c_sasl_bindop->o_tmpmemctx;
|
||||
op.o_tmpalloc = conn->c_sasl_bindop->o_tmpalloc;
|
||||
op.o_tmpfree = conn->c_sasl_bindop->o_tmpfree;
|
||||
op.o_tmpmfuncs = conn->c_sasl_bindop->o_tmpmfuncs;
|
||||
op.o_conn = conn;
|
||||
op.o_connid = conn->c_connid;
|
||||
op.ors_scope = LDAP_SCOPE_BASE;
|
||||
@ -565,8 +564,7 @@ slap_sasl_checkpass(
|
||||
op.o_is_auth_check = 1;
|
||||
op.o_threadctx = conn->c_sasl_bindop->o_threadctx;
|
||||
op.o_tmpmemctx = conn->c_sasl_bindop->o_tmpmemctx;
|
||||
op.o_tmpalloc = conn->c_sasl_bindop->o_tmpalloc;
|
||||
op.o_tmpfree = conn->c_sasl_bindop->o_tmpfree;
|
||||
op.o_tmpmfuncs = conn->c_sasl_bindop->o_tmpmfuncs;
|
||||
op.o_conn = conn;
|
||||
op.o_connid = conn->c_connid;
|
||||
op.ors_scope = LDAP_SCOPE_BASE;
|
||||
|
@ -452,8 +452,7 @@ int slap_sasl_match(Operation *opx, struct berval *rule, struct berval *assertDN
|
||||
op.o_is_auth_check = 1;
|
||||
op.o_threadctx = opx->o_threadctx;
|
||||
op.o_tmpmemctx = opx->o_tmpmemctx;
|
||||
op.o_tmpalloc = opx->o_tmpalloc;
|
||||
op.o_tmpfree = opx->o_tmpfree;
|
||||
op.o_tmpmfuncs = opx->o_tmpmfuncs;
|
||||
op.o_conn = opx->o_conn;
|
||||
op.o_connid = opx->o_connid;
|
||||
|
||||
@ -614,8 +613,7 @@ void slap_sasl2dn( Operation *opx,
|
||||
op.o_is_auth_check = 1;
|
||||
op.o_threadctx = opx->o_threadctx;
|
||||
op.o_tmpmemctx = opx->o_tmpmemctx;
|
||||
op.o_tmpalloc = opx->o_tmpalloc;
|
||||
op.o_tmpfree = opx->o_tmpfree;
|
||||
op.o_tmpmfuncs = opx->o_tmpmfuncs;
|
||||
op.oq_search.rs_deref = LDAP_DEREF_NEVER;
|
||||
op.oq_search.rs_slimit = 1;
|
||||
op.oq_search.rs_attrsonly = 1;
|
||||
|
@ -145,7 +145,7 @@ do_search(
|
||||
}
|
||||
goto return_results;
|
||||
}
|
||||
filter2bv_x( op->ors_filter, &op->ors_filterstr, op->o_tmpmemctx );
|
||||
filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ARGS,
|
||||
@ -478,7 +478,7 @@ static int doSearchRewriteFNs( Operation *op )
|
||||
*/
|
||||
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->ors_filter, &op->ors_filterstr, op->o_tmpmemctx );
|
||||
filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( OPERATION, ARGS,
|
||||
"doSearchRewriteFNs: after compute_rewrite_search filter: %s\n",
|
||||
|
@ -35,13 +35,14 @@ BER_MEMCALLOC_FN sl_calloc;
|
||||
BER_MEMREALLOC_FN sl_realloc;
|
||||
BER_MEMFREE_FN sl_free;
|
||||
|
||||
static BerMemoryFunctions sl_bmf =
|
||||
|
||||
BerMemoryFunctions sl_mfuncs =
|
||||
{ sl_malloc, sl_calloc, sl_realloc, sl_free };
|
||||
|
||||
void
|
||||
sl_mem_init()
|
||||
{
|
||||
ber_set_option( NULL, LBER_OPT_MEMORY_FNS, &sl_bmf );
|
||||
ber_set_option( NULL, LBER_OPT_MEMORY_FNS, &sl_mfuncs );
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -1840,8 +1840,11 @@ typedef struct slap_op {
|
||||
|
||||
void *o_threadctx; /* thread pool thread context */
|
||||
void *o_tmpmemctx; /* slab malloc context */
|
||||
BER_MEMALLOC_FN *o_tmpalloc;
|
||||
BER_MEMFREE_FN *o_tmpfree;
|
||||
BerMemoryFunctions *o_tmpmfuncs;
|
||||
#define o_tmpalloc o_tmpmfuncs->bmf_malloc
|
||||
#define o_tmpcalloc o_tmpmfuncs->bmf_calloc
|
||||
#define o_tmprealloc o_tmpmfuncs->bmf_realloc
|
||||
#define o_tmpfree o_tmpmfuncs->bmf_free
|
||||
void *o_private; /* anything the backend needs */
|
||||
|
||||
LDAP_STAILQ_ENTRY(slap_op) o_next; /* next operation in list */
|
||||
|
@ -68,8 +68,7 @@ str2filter( const char *str )
|
||||
Operation op = {0};
|
||||
|
||||
op.o_tmpmemctx = NULL;
|
||||
op.o_tmpalloc = ch_malloc;
|
||||
op.o_tmpfree = ch_free;
|
||||
op.o_tmpmfuncs = &ch_mfuncs;
|
||||
|
||||
return str2filter_x( &op, str );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user