version 1.31, 2000/05/15 21:47:51
|
version 1.32, 2000/05/16 14:22:52
|
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.30 2000/05/15 21:36:37 kurt Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.31 2000/05/15 21:47:51 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 361 get_substring_filter(
|
Line 361 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 */ |
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 398 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 427 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 498 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 |