From faa99564467f36a06b761e440c1f0acb2f783705 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 1 Mar 2002 18:52:45 +0000 Subject: [PATCH] Validate filter and compare inputs --- servers/slapd/ava.c | 3 ++- servers/slapd/compare.c | 3 ++- servers/slapd/filter.c | 9 ++++++++- servers/slapd/mra.c | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/servers/slapd/ava.c b/servers/slapd/ava.c index c9c2c1fee9..72ddab449c 100644 --- a/servers/slapd/ava.c +++ b/servers/slapd/ava.c @@ -63,7 +63,8 @@ get_ava( return rc; } - rc = value_normalize( aa->aa_desc, usage, &value, &aa->aa_value, text ); + rc = value_validate_normalize( aa->aa_desc, usage, + &value, &aa->aa_value, text ); if( rc != LDAP_SUCCESS ) { ch_free( aa ); diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 91cf820c37..87a88e4886 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -136,7 +136,8 @@ do_compare( goto cleanup; } - rc = value_normalize( ava.aa_desc, SLAP_MR_EQUALITY, &value, &ava.aa_value, &text ); + rc = value_validate_normalize( ava.aa_desc, SLAP_MR_EQUALITY, + &value, &ava.aa_value, &text ); if( rc != LDAP_SUCCESS ) { send_ldap_result( conn, op, rc, NULL, text, NULL, NULL ); goto cleanup; diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index b456d71966..3e9d764ab7 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -534,8 +534,15 @@ get_substring_filter( goto return_error; } - rc = value_normalize( f->f_sub_desc, usage, &value, &bv, text ); + /* valiate using equality matching rule validator! */ + rc = value_validate( f->f_sub_desc->ad_type->sat_equality, + &value, text ); + if( rc != LDAP_SUCCESS ) { + goto return_error; + } + rc = value_normalize( f->f_sub_desc, usage, + &value, &bv, text ); if( rc != LDAP_SUCCESS ) { goto return_error; } diff --git a/servers/slapd/mra.c b/servers/slapd/mra.c index 87b4a47dda..0223e44704 100644 --- a/servers/slapd/mra.c +++ b/servers/slapd/mra.c @@ -166,7 +166,8 @@ get_mra( * OK, if no matching rule, normalize for equality, otherwise * normalize for the matching rule. */ - rc = value_normalize( ma->ma_desc, SLAP_MR_EQUALITY, &value, &ma->ma_value, text ); + rc = value_validate_normalize( ma->ma_desc, SLAP_MR_EQUALITY, + &value, &ma->ma_value, text ); if( rc != LDAP_SUCCESS ) { mra_free( ma, 1 ); -- 2.39.5