Diff for /servers/slapd/filter.c between versions 1.92 and 1.93

version 1.92, 2003/03/01 10:08:53 version 1.93, 2003/03/09 19:11:12
Line 1 Line 1
 /* filter.c - routines for parsing and dealing with filters */  /* filter.c - routines for parsing and dealing with filters */
 /* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.91 2003/02/28 23:14:33 kurt Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.92 2003/03/01 10:08:53 ando Exp $ */
 /*  /*
  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.   * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file   * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
Line 608  filter2bv( Filter *f, struct berval *fst Line 608  filter2bv( Filter *f, struct berval *fst
   
                 fstr->bv_len = f->f_av_desc->ad_cname.bv_len +                  fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(=)") - 1 );                          tmp.bv_len + ( sizeof("(=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
                         f->f_av_desc->ad_cname.bv_val,                          f->f_av_desc->ad_cname.bv_val,
Line 622  filter2bv( Filter *f, struct berval *fst Line 622  filter2bv( Filter *f, struct berval *fst
   
                 fstr->bv_len = f->f_av_desc->ad_cname.bv_len +                  fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(>=)") - 1 );                          tmp.bv_len + ( sizeof("(>=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
                         f->f_av_desc->ad_cname.bv_val,                          f->f_av_desc->ad_cname.bv_val,
Line 636  filter2bv( Filter *f, struct berval *fst Line 636  filter2bv( Filter *f, struct berval *fst
   
                 fstr->bv_len = f->f_av_desc->ad_cname.bv_len +                  fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(<=)") - 1 );                          tmp.bv_len + ( sizeof("(<=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
                         f->f_av_desc->ad_cname.bv_val,                          f->f_av_desc->ad_cname.bv_val,
Line 650  filter2bv( Filter *f, struct berval *fst Line 650  filter2bv( Filter *f, struct berval *fst
   
                 fstr->bv_len = f->f_av_desc->ad_cname.bv_len +                  fstr->bv_len = f->f_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(~=)") - 1 );                          tmp.bv_len + ( sizeof("(~=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
                         f->f_av_desc->ad_cname.bv_val,                          f->f_av_desc->ad_cname.bv_val,
Line 661  filter2bv( Filter *f, struct berval *fst Line 661  filter2bv( Filter *f, struct berval *fst
         case LDAP_FILTER_SUBSTRINGS:          case LDAP_FILTER_SUBSTRINGS:
                 fstr->bv_len = f->f_sub_desc->ad_cname.bv_len +                  fstr->bv_len = f->f_sub_desc->ad_cname.bv_len +
                         ( sizeof("(=*)") - 1 );                          ( sizeof("(=*)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 128 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 128 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
                         f->f_sub_desc->ad_cname.bv_val );                          f->f_sub_desc->ad_cname.bv_val );
Line 716  filter2bv( Filter *f, struct berval *fst Line 716  filter2bv( Filter *f, struct berval *fst
         case LDAP_FILTER_PRESENT:          case LDAP_FILTER_PRESENT:
                 fstr->bv_len = f->f_desc->ad_cname.bv_len +                  fstr->bv_len = f->f_desc->ad_cname.bv_len +
                         ( sizeof("(=*)") - 1 );                          ( sizeof("(=*)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
                         f->f_desc->ad_cname.bv_val );                          f->f_desc->ad_cname.bv_val );
Line 726  filter2bv( Filter *f, struct berval *fst Line 726  filter2bv( Filter *f, struct berval *fst
         case LDAP_FILTER_OR:          case LDAP_FILTER_OR:
         case LDAP_FILTER_NOT:          case LDAP_FILTER_NOT:
                 fstr->bv_len = sizeof("(%)") - 1;                  fstr->bv_len = sizeof("(%)") - 1;
                 fstr->bv_val = malloc( fstr->bv_len + 128 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 128 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%c)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%c)",
                         f->f_choice == LDAP_FILTER_AND ? '&' :                          f->f_choice == LDAP_FILTER_AND ? '&' :
Line 763  filter2bv( Filter *f, struct berval *fst Line 763  filter2bv( Filter *f, struct berval *fst
                         ( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +                          ( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
                         ( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +                          ( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +
                         tmp.bv_len + ( sizeof("(:=)") - 1 );                          tmp.bv_len + ( sizeof("(:=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
                         ad.bv_val,                          ad.bv_val,
Line 1148  vrFilter2bv( ValuesReturnFilter *vrf, st Line 1148  vrFilter2bv( ValuesReturnFilter *vrf, st
         }          }
   
         fstr->bv_len = sizeof("()") - 1;          fstr->bv_len = sizeof("()") - 1;
         fstr->bv_val = malloc( fstr->bv_len + 128 );          fstr->bv_val = ch_malloc( fstr->bv_len + 128 );
   
         snprintf( fstr->bv_val, fstr->bv_len + 1, "()");          snprintf( fstr->bv_val, fstr->bv_len + 1, "()");
   
Line 1184  simple_vrFilter2bv( ValuesReturnFilter * Line 1184  simple_vrFilter2bv( ValuesReturnFilter *
   
                 fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +                  fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(=)") - 1 );                          tmp.bv_len + ( sizeof("(=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=%s)",
                         vrf->vrf_av_desc->ad_cname.bv_val,                          vrf->vrf_av_desc->ad_cname.bv_val,
Line 1198  simple_vrFilter2bv( ValuesReturnFilter * Line 1198  simple_vrFilter2bv( ValuesReturnFilter *
   
                 fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +                  fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(>=)") - 1 );                          tmp.bv_len + ( sizeof("(>=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s>=%s)",
                         vrf->vrf_av_desc->ad_cname.bv_val,                          vrf->vrf_av_desc->ad_cname.bv_val,
Line 1212  simple_vrFilter2bv( ValuesReturnFilter * Line 1212  simple_vrFilter2bv( ValuesReturnFilter *
   
                 fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +                  fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(<=)") - 1 );                          tmp.bv_len + ( sizeof("(<=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s<=%s)",
                         vrf->vrf_av_desc->ad_cname.bv_val,                          vrf->vrf_av_desc->ad_cname.bv_val,
Line 1226  simple_vrFilter2bv( ValuesReturnFilter * Line 1226  simple_vrFilter2bv( ValuesReturnFilter *
   
                 fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +                  fstr->bv_len = vrf->vrf_av_desc->ad_cname.bv_len +
                         tmp.bv_len + ( sizeof("(~=)") - 1 );                          tmp.bv_len + ( sizeof("(~=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s~=%s)",
                         vrf->vrf_av_desc->ad_cname.bv_val,                          vrf->vrf_av_desc->ad_cname.bv_val,
Line 1237  simple_vrFilter2bv( ValuesReturnFilter * Line 1237  simple_vrFilter2bv( ValuesReturnFilter *
         case LDAP_FILTER_SUBSTRINGS:          case LDAP_FILTER_SUBSTRINGS:
                 fstr->bv_len = vrf->vrf_sub_desc->ad_cname.bv_len +                  fstr->bv_len = vrf->vrf_sub_desc->ad_cname.bv_len +
                         ( sizeof("(=*)") - 1 );                          ( sizeof("(=*)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 128 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 128 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
                         vrf->vrf_sub_desc->ad_cname.bv_val );                          vrf->vrf_sub_desc->ad_cname.bv_val );
Line 1293  simple_vrFilter2bv( ValuesReturnFilter * Line 1293  simple_vrFilter2bv( ValuesReturnFilter *
         case LDAP_FILTER_PRESENT:          case LDAP_FILTER_PRESENT:
                 fstr->bv_len = vrf->vrf_desc->ad_cname.bv_len +                  fstr->bv_len = vrf->vrf_desc->ad_cname.bv_len +
                         ( sizeof("(=*)") - 1 );                          ( sizeof("(=*)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s=*)",
                         vrf->vrf_desc->ad_cname.bv_val );                          vrf->vrf_desc->ad_cname.bv_val );
Line 1314  simple_vrFilter2bv( ValuesReturnFilter * Line 1314  simple_vrFilter2bv( ValuesReturnFilter *
                         ( vrf->vrf_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +                          ( vrf->vrf_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
                         ( vrf->vrf_mr_rule_text.bv_len ? vrf->vrf_mr_rule_text.bv_len+1 : 0 ) +                          ( vrf->vrf_mr_rule_text.bv_len ? vrf->vrf_mr_rule_text.bv_len+1 : 0 ) +
                         tmp.bv_len + ( sizeof("(:=)") - 1 );                          tmp.bv_len + ( sizeof("(:=)") - 1 );
                 fstr->bv_val = malloc( fstr->bv_len + 1 );                  fstr->bv_val = ch_malloc( fstr->bv_len + 1 );
   
                 snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",                  snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
                         ad.bv_val,                          ad.bv_val,

Removed from v.1.92  
changed lines
  Added in v.1.93


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org