version 1.126, 2005/01/01 19:49:49
|
version 1.127, 2005/06/20 22:38:55
|
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.125 2004/11/25 21:59:01 hyc Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/filter.c,v 1.126 2005/01/01 19:49:49 kurt Exp $ */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
* Copyright 1998-2005 The OpenLDAP Foundation. |
* Copyright 1998-2005 The OpenLDAP Foundation. |
Line 382 get_ssa(
|
Line 382 get_ssa(
|
|
|
switch ( tag ) { |
switch ( tag ) { |
case LDAP_SUBSTRING_INITIAL: |
case LDAP_SUBSTRING_INITIAL: |
|
if ( ssa.sa_initial.bv_val != NULL |
|
|| ssa.sa_any != NULL |
|
|| ssa.sa_final.bv_val != NULL ) |
|
{ |
|
rc = LDAP_PROTOCOL_ERROR; |
|
goto return_error; |
|
} |
usage = SLAP_MR_SUBSTR_INITIAL; |
usage = SLAP_MR_SUBSTR_INITIAL; |
break; |
break; |
|
|
case LDAP_SUBSTRING_ANY: |
case LDAP_SUBSTRING_ANY: |
|
if ( ssa.sa_final.bv_val != NULL ) { |
|
rc = LDAP_PROTOCOL_ERROR; |
|
goto return_error; |
|
} |
usage = SLAP_MR_SUBSTR_ANY; |
usage = SLAP_MR_SUBSTR_ANY; |
break; |
break; |
|
|
case LDAP_SUBSTRING_FINAL: |
case LDAP_SUBSTRING_FINAL: |
|
if ( ssa.sa_final.bv_val != NULL ) { |
|
rc = LDAP_PROTOCOL_ERROR; |
|
goto return_error; |
|
} |
|
|
usage = SLAP_MR_SUBSTR_FINAL; |
usage = SLAP_MR_SUBSTR_FINAL; |
break; |
break; |
|
|
default: |
default: |
rc = LDAP_PROTOCOL_ERROR; |
|
|
|
Debug( LDAP_DEBUG_FILTER, |
Debug( LDAP_DEBUG_FILTER, |
" unknown substring choice=%ld\n", |
" unknown substring choice=%ld\n", |
(long) tag, 0, 0 ); |
(long) tag, 0, 0 ); |
|
|
|
rc = LDAP_PROTOCOL_ERROR; |
goto return_error; |
goto return_error; |
} |
} |
|
|
Line 407 get_ssa(
|
Line 422 get_ssa(
|
rc = asserted_value_validate_normalize( |
rc = asserted_value_validate_normalize( |
ssa.sa_desc, ssa.sa_desc->ad_type->sat_equality, |
ssa.sa_desc, ssa.sa_desc->ad_type->sat_equality, |
usage, &value, &nvalue, text, op->o_tmpmemctx ); |
usage, &value, &nvalue, text, op->o_tmpmemctx ); |
|
if( rc != LDAP_SUCCESS ) goto return_error; |
if( rc != LDAP_SUCCESS ) { |
|
goto return_error; |
|
} |
|
|
|
rc = LDAP_PROTOCOL_ERROR; |
|
|
|
switch ( tag ) { |
switch ( tag ) { |
case LDAP_SUBSTRING_INITIAL: |
case LDAP_SUBSTRING_INITIAL: |
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 ); |
|
|
if ( ssa.sa_initial.bv_val != NULL |
|
|| ssa.sa_any != NULL |
|
|| ssa.sa_final.bv_val != NULL ) |
|
{ |
|
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx ); |
|
goto return_error; |
|
} |
|
|
|
ssa.sa_initial = nvalue; |
ssa.sa_initial = nvalue; |
break; |
break; |
|
|
case LDAP_SUBSTRING_ANY: |
case LDAP_SUBSTRING_ANY: |
Debug( LDAP_DEBUG_FILTER, " ANY\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, " ANY\n", 0, 0, 0 ); |
|
|
if ( ssa.sa_final.bv_val != NULL ) { |
|
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx ); |
|
goto return_error; |
|
} |
|
|
|
ber_bvarray_add_x( &ssa.sa_any, &nvalue, op->o_tmpmemctx ); |
ber_bvarray_add_x( &ssa.sa_any, &nvalue, op->o_tmpmemctx ); |
break; |
break; |
|
|
case LDAP_SUBSTRING_FINAL: |
case LDAP_SUBSTRING_FINAL: |
Debug( LDAP_DEBUG_FILTER, " FINAL\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, " FINAL\n", 0, 0, 0 ); |
|
|
if ( ssa.sa_final.bv_val != NULL ) { |
|
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx ); |
|
goto return_error; |
|
} |
|
|
|
ssa.sa_final = nvalue; |
ssa.sa_final = nvalue; |
break; |
break; |
|
|
default: |
default: |
Debug( LDAP_DEBUG_FILTER, |
|
" unknown substring type=%ld\n", |
|
(long) tag, 0, 0 ); |
|
|
|
assert( 0 ); |
assert( 0 ); |
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx ); |
slap_sl_free( nvalue.bv_val, op->o_tmpmemctx ); |
|
rc = LDAP_PROTOCOL_ERROR; |
|
|
return_error: |
return_error: |
Debug( LDAP_DEBUG_FILTER, " error=%ld\n", |
Debug( LDAP_DEBUG_FILTER, " error=%ld\n", |
Line 477 return_error:
|
Line 463 return_error:
|
} |
} |
|
|
Debug( LDAP_DEBUG_FILTER, "end get_ssa\n", 0, 0, 0 ); |
Debug( LDAP_DEBUG_FILTER, "end get_ssa\n", 0, 0, 0 ); |
|
|
return rc /* LDAP_SUCCESS */ ; |
return rc /* LDAP_SUCCESS */ ; |
} |
} |
|
|