mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 09:09:54 -05:00
Modify ava code to return error text
Filter code needs to be updated to properly handle soft errors.
This commit is contained in:
parent
c689e1cb74
commit
8d407bc2a6
3 changed files with 17 additions and 14 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue