Diff for /servers/slapd/filter.c between versions 1.30 and 1.38

version 1.30, 2000/05/15 21:36:37 version 1.38, 2000/05/17 18:08:13
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.29 2000/05/15 17:28:26 kurt Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.37 2000/05/16 20:04:49 kurt Exp $ */
 /*  /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.   * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file   * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
Line 94  get_filter( Line 94  get_filter(
         case LDAP_FILTER_EQUALITY:          case LDAP_FILTER_EQUALITY:
                 Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );                  Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
   
                 if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) {  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                         *text = "error decoding filter";                  err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY, text );
   #else
                   err = get_ava( ber, &f->f_ava, text );
   #endif
                   if ( err != LDAP_SUCCESS ) {
                         break;                          break;
                 }                  }
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                   assert( f->f_ava != NULL );
   
                 *fstr = ch_malloc( sizeof("(=)")                  *fstr = ch_malloc( sizeof("(=)")
                         + f->f_av_desc->ad_cname->bv_len                          + f->f_av_desc->ad_cname->bv_len
                         + f->f_av_value->bv_len );                          + f->f_av_value->bv_len );
Line 125  get_filter( Line 131  get_filter(
         case LDAP_FILTER_GE:          case LDAP_FILTER_GE:
                 Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );                  Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
   
                 if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) {  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                         *text = "decoding filter error";                  err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
   #else
                   err = get_ava( ber, &f->f_ava, text );
   #endif
                   if ( err != LDAP_SUCCESS ) {
                         break;                          break;
                 }                  }
   
Line 151  get_filter( Line 161  get_filter(
         case LDAP_FILTER_LE:          case LDAP_FILTER_LE:
                 Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );                  Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
   
                 if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) {  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                         *text = "decoding filter error";                  err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
   #else
                   err = get_ava( ber, &f->f_ava, text );
   #endif
                   if ( err != LDAP_SUCCESS ) {
                         break;                          break;
                 }                  }
   
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                 *fstr = ch_malloc( sizeof("(<=)")                  *fstr = ch_malloc( sizeof("(<=)")
                         + f->f_av_desc->ad_cname->bv_len                          + f->f_av_desc->ad_cname->bv_len
Line 186  get_filter( Line 201  get_filter(
                 }                  }
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                 {                  f->f_desc = NULL;
                         char *text;                  err = slap_bv2ad( &type, &f->f_desc, text );
                         int rc;  
   
                         err = slap_bv2ad( &type, &f->f_desc, &text );  
   
                         if( err != LDAP_SUCCESS ) {  
                                 ch_free( type.bv_val );  
                                 break;  
                         }  
   
                   if( err != LDAP_SUCCESS ) {
                         ch_free( type.bv_val );                          ch_free( type.bv_val );
                           break;
                 }                  }
   
                   ch_free( type.bv_val );
   
                 *fstr = ch_malloc( sizeof("(=*)")                  *fstr = ch_malloc( sizeof("(=*)")
                         + f->f_desc->ad_cname->bv_len );                          + f->f_desc->ad_cname->bv_len );
                 sprintf( *fstr, "(%s=*)",                  sprintf( *fstr, "(%s=*)",
Line 218  get_filter( Line 229  get_filter(
         case LDAP_FILTER_APPROX:          case LDAP_FILTER_APPROX:
                 Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );                  Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
   
                 if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) {  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                         *text = "decoding filter error";                  err = get_ava( ber, &f->f_ava, SLAP_MR_APPROX, text );
   #else
                   err = get_ava( ber, &f->f_ava, text );
   #endif
                   if ( err != LDAP_SUCCESS ) {
                         break;                          break;
                 }                  }
   
Line 361  get_substring_filter( Line 376  get_substring_filter(
         ber_tag_t       rc;          ber_tag_t       rc;
         struct berval *val;          struct berval *val;
         char            *last;          char            *last;
         char            *type;          struct berval type;
   #ifndef SLAPD_SCHEMA_NOT_COMPAT
         int             syntax;          int             syntax;
   #endif
         *text = "error decoding filter";          *text = "error decoding filter";
   
         Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );          Debug( LDAP_DEBUG_FILTER, "begin get_substring_filter\n", 0, 0, 0 );
   
         if ( ber_scanf( ber, "{a" /*}*/, &type ) == LBER_ERROR ) {          if ( ber_scanf( ber, "{o" /*}*/, &type ) == LBER_ERROR ) {
                 return SLAPD_DISCONNECT;                  return SLAPD_DISCONNECT;
         }          }
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifdef SLAPD_SCHEMA_NOT_COMPAT
         /* not yet implemented */          f->f_sub_desc = NULL;
           rc = slap_bv2ad( &type, &f->f_sub_desc, text );
   
           ch_free( type.bv_val );
   
           if( rc != LDAP_SUCCESS ) {
                   text = NULL;
                   f->f_choice = SLAPD_FILTER_COMPUTED;
                   f->f_result = SLAPD_COMPARE_UNDEFINED;
                   *fstr = ch_strdup( "(undefined)" );
                   return LDAP_SUCCESS;
           }
 #else  #else
         f->f_sub_type = type;          f->f_sub_type = type.bv_val;
         attr_normalize( f->f_sub_type );          attr_normalize( f->f_sub_type );
   
         /* should get real syntax and see if we have a substring matching rule */          /* should get real syntax and see if we have a substring matching rule */
Line 387  get_substring_filter( Line 414  get_substring_filter(
         f->f_sub_final = NULL;          f->f_sub_final = NULL;
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifdef SLAPD_SCHEMA_NOT_COMPAT
         /* not yet implemented */          if( fstr ) {
                   *fstr = ch_malloc( sizeof("(=" /*)*/) +
                           f->f_sub_desc->ad_cname->bv_len );
                   sprintf( *fstr, "(%s=" /*)*/, f->f_sub_desc->ad_cname->bv_val );
           }
 #else  #else
         if( fstr ) {          if( fstr ) {
                 *fstr = ch_malloc( strlen( f->f_sub_type ) + 3 );                  *fstr = ch_malloc( strlen( f->f_sub_type ) + 3 );
Line 412  get_substring_filter( Line 443  get_substring_filter(
   
                 rc = LDAP_PROTOCOL_ERROR;                  rc = LDAP_PROTOCOL_ERROR;
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifndef SLAPD_SCHEMA_NOT_COMPAT
                 /* not yet implemented */  
 #else  
                 /* we should call a substring syntax normalization routine */                  /* we should call a substring syntax normalization routine */
                 value_normalize( val->bv_val, syntax );                  value_normalize( val->bv_val, syntax );
                 /* this is bogus, value_normalize should take a berval */                  /* this is bogus, value_normalize should take a berval */
Line 485  return_error: Line 514  return_error:
                         }                          }
   
 #ifdef SLAPD_SCHEMA_NOT_COMPAT  #ifdef SLAPD_SCHEMA_NOT_COMPAT
                         /* not yet implemented */                          ad_free( f->f_sub_desc, 1 );
 #else  #else
                         ch_free( f->f_sub_type );                          ch_free( f->f_sub_type );
 #endif  #endif

Removed from v.1.30  
changed lines
  Added in v.1.38


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