X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Ffilter.c;h=5eac384b758ee3fba02c63ce3ac4b6b2671c3e12;hb=24db207196a453a4f9acdce08593c7e0ed53ce4c;hp=3bd61e0a3c27344917eafd925f953e674f629b45;hpb=bd33fc86788281bde4a54b77a996c18d7940bd68;p=openldap diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 3bd61e0a3c..5eac384b75 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2006 The OpenLDAP Foundation. + * Copyright 1998-2007 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,6 +33,9 @@ #include "slap.h" +const Filter *slap_filter_objectClass_pres; +const struct berval *slap_filterstr_objectClass_pres; + static int get_filter_list( Operation *op, BerElement *ber, @@ -56,6 +59,26 @@ static int get_simple_vrFilter( ValuesReturnFilter **f, const char **text ); +int +filter_init( void ) +{ + static Filter filter_objectClass_pres = { LDAP_FILTER_PRESENT }; + static struct berval filterstr_objectClass_pres = BER_BVC("(objectClass=*)"); + + filter_objectClass_pres.f_desc = slap_schema.si_ad_objectClass; + + slap_filter_objectClass_pres = &filter_objectClass_pres; + slap_filterstr_objectClass_pres = &filterstr_objectClass_pres; + + return 0; +} + +void +filter_destroy( void ) +{ + return; +} + int get_filter( Operation *op, @@ -618,16 +641,16 @@ simple: len = fstr->bv_len; filter_escape_value_x( &f->f_sub_initial, &tmp, op->o_tmpmemctx ); - tmplen = tmp.bv_len ? tmp.bv_len : STRLENOF( "(null)" ); + tmplen = tmp.bv_len; fstr->bv_len += tmplen; fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx ); - snprintf( &fstr->bv_val[len-2], + snprintf( &fstr->bv_val[len - 2], tmplen + STRLENOF( /*(*/ "*)" ) + 1, /* "(attr=" */ "%s*)", - tmp.bv_len ? tmp.bv_val : "(null)"); + tmp.bv_len ? tmp.bv_val : ""); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); } @@ -639,16 +662,16 @@ simple: len = fstr->bv_len; filter_escape_value_x( &f->f_sub_any[i], &tmp, op->o_tmpmemctx ); - tmplen = tmp.bv_len ? tmp.bv_len : STRLENOF( "(null)" ); + tmplen = tmp.bv_len; fstr->bv_len += tmplen + STRLENOF( /*(*/ ")" ); fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx ); - snprintf( &fstr->bv_val[len-1], + snprintf( &fstr->bv_val[len - 1], tmplen + STRLENOF( /*(*/ "*)" ) + 1, /* "(attr=[init]*[any*]" */ "%s*)", - tmp.bv_len ? tmp.bv_val : "(null)"); + tmp.bv_len ? tmp.bv_val : ""); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); } } @@ -659,16 +682,16 @@ simple: len = fstr->bv_len; filter_escape_value_x( &f->f_sub_final, &tmp, op->o_tmpmemctx ); - tmplen = tmp.bv_len ? tmp.bv_len : STRLENOF( "(null)" ); + tmplen = tmp.bv_len; fstr->bv_len += tmplen; fstr->bv_val = op->o_tmprealloc( fstr->bv_val, fstr->bv_len + 1, op->o_tmpmemctx ); - snprintf( &fstr->bv_val[len-1], + snprintf( &fstr->bv_val[len - 1], tmplen + STRLENOF( /*(*/ ")" ) + 1, /* "(attr=[init*][any*]" */ "%s)", - tmp.bv_len ? tmp.bv_val : "(null)"); + tmp.bv_len ? tmp.bv_val : ""); ber_memfree_x( tmp.bv_val, op->o_tmpmemctx ); }