version 1.20, 2000/01/31 21:14:16
|
version 1.21, 2000/02/06 20:09:45
|
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.19 2000/01/28 19:01:00 kurt Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.20 2000/01/31 21:14:16 kurt Exp $ */ |
/* |
/* |
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. |
* Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved. |
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file |
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file |
Line 68 get_filter( Connection *conn, BerElement
|
Line 68 get_filter( Connection *conn, BerElement
|
f->f_choice = ber_peek_tag( ber, &len ); |
f->f_choice = ber_peek_tag( ber, &len ); |
|
|
switch ( f->f_choice ) { |
switch ( f->f_choice ) { |
|
#ifndef SLAPD_SCHEMA_NOT_COMPAT |
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 ) { |
if ( (err = get_ava( ber, &f->f_ava )) == LDAP_SUCCESS ) { |
Line 124 get_filter( Connection *conn, BerElement
|
Line 125 get_filter( Connection *conn, BerElement
|
f->f_avvalue.bv_val ); |
f->f_avvalue.bv_val ); |
} |
} |
break; |
break; |
|
#endif |
|
|
case LDAP_FILTER_AND: |
case LDAP_FILTER_AND: |
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, "AND\n", 0, 0, 0 ); |
Line 158 get_filter( Connection *conn, BerElement
|
Line 160 get_filter( Connection *conn, BerElement
|
} |
} |
break; |
break; |
|
|
|
case LDAP_FILTER_EXT: |
|
/* not yet implemented */ |
|
Debug( LDAP_DEBUG_ANY, "extensible match not yet implemented.\n", |
|
f->f_choice, 0, 0 ); |
|
err = -1; |
|
break; |
|
|
case LBER_DEFAULT: |
case LBER_DEFAULT: |
Debug( LDAP_DEBUG_ANY, "decoding filter error\n", |
Debug( LDAP_DEBUG_ANY, "decoding filter error\n", |
0, 0, 0 ); |
0, 0, 0 ); |
Line 218 get_filter_list( Connection *conn, BerEl
|
Line 227 get_filter_list( Connection *conn, BerEl
|
return( LDAP_SUCCESS ); |
return( LDAP_SUCCESS ); |
} |
} |
|
|
|
#ifndef SLAPD_SCHEMA_NOT_COMPAT |
|
|
static int |
static int |
get_substring_filter( |
get_substring_filter( |
Connection *conn, |
Connection *conn, |
Line 362 return_error:
|
Line 373 return_error:
|
return( LDAP_SUCCESS ); |
return( LDAP_SUCCESS ); |
} |
} |
|
|
|
#endif /* not compat */ |
|
|
void |
void |
filter_free( Filter *f ) |
filter_free( Filter *f ) |
{ |
{ |
Line 372 filter_free( Filter *f )
|
Line 385 filter_free( Filter *f )
|
} |
} |
|
|
switch ( f->f_choice ) { |
switch ( f->f_choice ) { |
|
case LDAP_FILTER_PRESENT: |
|
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
ad_free( f->f_desc, 1 ); |
|
#else |
|
if ( f->f_type != NULL ) { |
|
free( f->f_type ); |
|
} |
|
#endif |
|
break; |
|
|
case LDAP_FILTER_EQUALITY: |
case LDAP_FILTER_EQUALITY: |
case LDAP_FILTER_GE: |
case LDAP_FILTER_GE: |
case LDAP_FILTER_LE: |
case LDAP_FILTER_LE: |
case LDAP_FILTER_APPROX: |
case LDAP_FILTER_APPROX: |
|
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
ava_free( f->f_ava, 1 ); |
|
#else |
ava_free( &f->f_ava, 0 ); |
ava_free( &f->f_ava, 0 ); |
|
#endif |
break; |
break; |
|
|
case LDAP_FILTER_SUBSTRINGS: |
case LDAP_FILTER_SUBSTRINGS: |
|
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
ad_free( f->f_sub_desc, 1 ); |
|
if ( f->f_sub_initial != NULL ) { |
|
ber_bvfree( f->f_sub_initial ); |
|
} |
|
ber_bvecfree( f->f_sub_any ); |
|
if ( f->f_sub_final != NULL ) { |
|
ber_bvfree( f->f_sub_final ); |
|
} |
|
#else |
if ( f->f_sub_type != NULL ) { |
if ( f->f_sub_type != NULL ) { |
free( f->f_sub_type ); |
free( f->f_sub_type ); |
} |
} |
Line 390 filter_free( Filter *f )
|
Line 427 filter_free( Filter *f )
|
if ( f->f_sub_final != NULL ) { |
if ( f->f_sub_final != NULL ) { |
ber_bvfree( f->f_sub_final ); |
ber_bvfree( f->f_sub_final ); |
} |
} |
break; |
#endif |
|
|
case LDAP_FILTER_PRESENT: |
|
if ( f->f_type != NULL ) { |
|
free( f->f_type ); |
|
} |
|
break; |
break; |
|
|
case LDAP_FILTER_AND: |
case LDAP_FILTER_AND: |
Line 412 filter_free( Filter *f )
|
Line 444 filter_free( Filter *f )
|
f->f_choice, 0, 0 ); |
f->f_choice, 0, 0 ); |
break; |
break; |
} |
} |
|
|
free( f ); |
free( f ); |
} |
} |
|
|