version 1.28, 2000/05/15 16:46:03
|
version 1.29, 2000/05/15 17:28:26
|
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.27 2000/05/13 00:47:57 kurt Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.28 2000/05/15 16:46:03 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 93 get_filter(
|
Line 93 get_filter(
|
switch ( f->f_choice ) { |
switch ( f->f_choice ) { |
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 ); |
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
*text = "error decoding filter"; |
*text = "error decoding filter"; |
break; |
break; |
} |
} |
|
|
|
#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 |
+ f->f_av_value->bv_len ); |
+ f->f_av_value->bv_len ); |
Line 108 get_filter(
|
Line 109 get_filter(
|
f->f_av_value->bv_val ); |
f->f_av_value->bv_val ); |
|
|
#else |
#else |
if ( (err = get_ava( ber, f->f_ava )) != LDAP_SUCCESS ) { |
|
*text = "error decoding filter"; |
|
break; |
|
} |
|
|
|
*fstr = ch_malloc( sizeof("(=)") |
*fstr = ch_malloc( sizeof("(=)") |
+ strlen( f->f_avtype ) |
+ strlen( f->f_avtype ) |
+ f->f_avvalue.bv_len); |
+ f->f_avvalue.bv_len); |
Line 128 get_filter(
|
Line 124 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 ); |
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
*text = "decoding filter error"; |
*text = "decoding filter error"; |
break; |
break; |
} |
} |
|
|
|
#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 |
+ f->f_av_value->bv_len ); |
+ f->f_av_value->bv_len ); |
Line 143 get_filter(
|
Line 140 get_filter(
|
f->f_av_value->bv_val ); |
f->f_av_value->bv_val ); |
|
|
#else |
#else |
if ( (err = get_ava( ber, f->f_ava )) != LDAP_SUCCESS ) { |
*fstr = ch_malloc( sizeof("(>=)") |
*text = "decoding filter error"; |
|
break; |
|
} |
|
|
|
*fstr = ch_malloc( sizeof("(>=)" |
|
+ strlen( f->f_avtype ) |
+ strlen( f->f_avtype ) |
+ f->f_avvalue.bv_len); |
+ f->f_avvalue.bv_len); |
sprintf( *fstr, "(%s>=%s)", f->f_avtype, |
sprintf( *fstr, "(%s>=%s)", f->f_avtype, |
Line 158 get_filter(
|
Line 150 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 ); |
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
*text = "decoding filter error"; |
*text = "decoding filter error"; |
break; |
break; |
} |
} |
|
|
|
#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 |
+ f->f_av_value->bv_len ); |
+ f->f_av_value->bv_len ); |
Line 173 get_filter(
|
Line 167 get_filter(
|
f->f_av_value->bv_val ); |
f->f_av_value->bv_val ); |
|
|
#else |
#else |
if ( (err = get_ava( ber, f->f_ava )) != LDAP_SUCCESS ) { |
*fstr = ch_malloc( sizeof("(<=)") |
*text = "error decoding filter"; |
|
break; |
|
} |
|
*fstr = ch_malloc( sizeof("(<=)" |
|
+ strlen( f->f_avtype ) |
+ strlen( f->f_avtype ) |
+ f->f_avvalue.bv_len); |
+ f->f_avvalue.bv_len); |
sprintf( *fstr, "(%s<=%s)", f->f_avtype, |
sprintf( *fstr, "(%s<=%s)", f->f_avtype, |
Line 227 get_filter(
|
Line 217 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 ); |
#ifdef SLAPD_SCHEMA_NOT_COMPAT |
|
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { |
*text = "decoding filter error"; |
*text = "decoding filter error"; |
break; |
break; |
} |
} |
|
|
|
#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 |
+ f->f_av_value->bv_len ); |
+ f->f_av_value->bv_len ); |
Line 242 get_filter(
|
Line 233 get_filter(
|
f->f_av_value->bv_val ); |
f->f_av_value->bv_val ); |
|
|
#else |
#else |
if ( (err = get_ava( ber, f->f_ava )) != LDAP_SUCCESS ) { |
*fstr = ch_malloc( sizeof("(~=)") |
*text = "error decoding filter"; |
|
break; |
|
} |
|
*fstr = ch_malloc( sizeof("(~=)" |
|
+ strlen( f->f_avtype ) |
+ strlen( f->f_avtype ) |
+ f->f_avvalue.bv_len); |
+ f->f_avvalue.bv_len); |
sprintf( *fstr, "(%s~=%s)", f->f_avtype, |
sprintf( *fstr, "(%s~=%s)", f->f_avtype, |