From: Kurt Zeilenga Date: Tue, 16 May 2000 21:03:18 +0000 (+0000) Subject: Modify ava code to return error text X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2941 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8d407bc2a69e8682a01b0f700150d082b0146a80;p=openldap Modify ava code to return error text Filter code needs to be updated to properly handle soft errors. --- diff --git a/servers/slapd/ava.c b/servers/slapd/ava.c index 5493cb2be3..6b11ba04a8 100644 --- a/servers/slapd/ava.c +++ b/servers/slapd/ava.c @@ -32,11 +32,11 @@ ava_free( int get_ava( BerElement *ber, - AttributeAssertion **ava + AttributeAssertion **ava, + char **text ) { int rc; - char *text; struct berval type, *value; AttributeAssertion *aa; @@ -44,13 +44,14 @@ get_ava( if( rc == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 ); + *text = "Error decoding attribute value assertion"; return SLAPD_DISCONNECT; } aa = ch_malloc( sizeof( AttributeAssertion ) ); aa->aa_desc = NULL; - rc = slap_bv2ad( &type, &aa->aa_desc, &text ); + rc = slap_bv2ad( &type, &aa->aa_desc, text ); if( rc != LDAP_SUCCESS ) { ch_free( type.bv_val ); @@ -83,12 +84,14 @@ ava_free( int get_ava( BerElement *ber, - Ava *ava + Ava *ava, + char **text ) { if ( ber_scanf( ber, "{ao}", &ava->ava_type, &ava->ava_value ) == LBER_ERROR ) { Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 ); + *text = "Error decoding attribute value assertion"; return SLAPD_DISCONNECT; } diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 072414800c..33d7d996f4 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -94,8 +94,7 @@ get_filter( case LDAP_FILTER_EQUALITY: Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 ); - if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { - *text = "error decoding filter"; + if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) { break; } @@ -127,8 +126,7 @@ get_filter( case LDAP_FILTER_GE: Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 ); - if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { - *text = "decoding filter error"; + if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) { break; } @@ -153,8 +151,7 @@ get_filter( case LDAP_FILTER_LE: Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 ); - if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { - *text = "decoding filter error"; + if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) { break; } @@ -220,8 +217,7 @@ get_filter( case LDAP_FILTER_APPROX: Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 ); - if ( (err = get_ava( ber, &f->f_ava )) != LDAP_SUCCESS ) { - *text = "decoding filter error"; + if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) { break; } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 90a269c6ae..7acb5aedcb 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -142,12 +142,16 @@ LIBSLAPD_F (Attribute *) attrs_dup LDAP_P(( Attribute *a )); #ifdef SLAPD_SCHEMA_NOT_COMPAT LIBSLAPD_F (int) get_ava LDAP_P(( BerElement *ber, - AttributeAssertion **ava )); + AttributeAssertion **ava, + char **text )); LIBSLAPD_F (void) ava_free LDAP_P(( AttributeAssertion *ava, int freeit )); #else -LIBSLAPD_F (int) get_ava LDAP_P(( BerElement *ber, Ava *ava )); +LIBSLAPD_F (int) get_ava LDAP_P(( + BerElement *ber, + Ava *ava, + char **text )); LIBSLAPD_F (void) ava_free LDAP_P(( Ava *ava, int freeit )); #endif