SLAP_SCHEMA_NOT_COMPAT: add calls to dummy value_normalize()

SLAP_SCHEMA_NOT_COMPAT: Need to sort out normalization of substring components
This commit is contained in:
Kurt Zeilenga 2000-05-17 20:08:13 +00:00
parent 75b51d523f
commit 1f22c52b8a
5 changed files with 108 additions and 41 deletions

View file

@ -33,6 +33,7 @@ int
get_ava(
BerElement *ber,
AttributeAssertion **ava,
unsigned usage,
char **text
)
{
@ -60,6 +61,16 @@ get_ava(
return rc;
}
rc = value_normalize( aa->aa_desc, usage, value, text );
if( rc != LDAP_SUCCESS ) {
ch_free( type.bv_val );
ber_bvfree( value );
ad_free( aa->aa_desc, 1 );
ch_free( aa );
return rc;
}
aa->aa_value = value;
*ava = aa;

View file

@ -105,6 +105,15 @@ do_compare(
text, NULL, NULL );
goto cleanup;
}
rc = value_normalize( ava.aa_desc, SLAP_MR_EQUALITY, &value, &text );
if( rc != LDAP_SUCCESS ) {
send_ldap_result( conn, op, rc, NULL,
text, NULL, NULL );
goto cleanup;
}
ava.aa_value = &value;
Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",

View file

@ -94,11 +94,15 @@ get_filter(
case LDAP_FILTER_EQUALITY:
Debug( LDAP_DEBUG_FILTER, "EQUALITY\n", 0, 0, 0 );
if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
err = get_ava( ber, &f->f_ava, SLAP_MR_EQUALITY, text );
#else
err = get_ava( ber, &f->f_ava, text );
#endif
if ( err != LDAP_SUCCESS ) {
break;
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
assert( f->f_ava != NULL );
@ -127,7 +131,12 @@ get_filter(
case LDAP_FILTER_GE:
Debug( LDAP_DEBUG_FILTER, "GE\n", 0, 0, 0 );
if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
#else
err = get_ava( ber, &f->f_ava, text );
#endif
if ( err != LDAP_SUCCESS ) {
break;
}
@ -152,10 +161,16 @@ get_filter(
case LDAP_FILTER_LE:
Debug( LDAP_DEBUG_FILTER, "LE\n", 0, 0, 0 );
if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
err = get_ava( ber, &f->f_ava, SLAP_MR_ORDERING, text );
#else
err = get_ava( ber, &f->f_ava, text );
#endif
if ( err != LDAP_SUCCESS ) {
break;
}
#ifdef SLAPD_SCHEMA_NOT_COMPAT
*fstr = ch_malloc( sizeof("(<=)")
+ f->f_av_desc->ad_cname->bv_len
@ -214,7 +229,12 @@ get_filter(
case LDAP_FILTER_APPROX:
Debug( LDAP_DEBUG_FILTER, "APPROX\n", 0, 0, 0 );
if ( (err = get_ava( ber, &f->f_ava, text )) != LDAP_SUCCESS ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
err = get_ava( ber, &f->f_ava, SLAP_MR_APPROX, text );
#else
err = get_ava( ber, &f->f_ava, text );
#endif
if ( err != LDAP_SUCCESS ) {
break;
}

View file

@ -112,10 +112,6 @@ LIBSLAPD_F (char *) at_canonical_name LDAP_P(( const char * a_type ));
LIBSLAPD_F (void) attr_free LDAP_P(( Attribute *a ));
LIBSLAPD_F (Attribute *) attr_dup LDAP_P(( Attribute *a ));
LIBSLAPD_F (char *) attr_normalize LDAP_P(( char *s ));
LIBSLAPD_F (int) attr_merge_fast LDAP_P(( Entry *e, const char *type,
struct berval **vals, int nvals, int naddvals, int *maxvals,
Attribute ***a ));
#ifdef SLAPD_SCHEMA_NOT_COMPAT
LIBSLAPD_F (int) attr_merge LDAP_P(( Entry *e,
@ -125,8 +121,12 @@ LIBSLAPD_F (Attribute *) attrs_find LDAP_P(( Attribute *a, AttributeDescription
LIBSLAPD_F (Attribute *) attr_find LDAP_P(( Attribute *a, AttributeDescription *desc ));
LIBSLAPD_F (int) attr_delete LDAP_P(( Attribute **attrs, AttributeDescription *desc ));
#else
LIBSLAPD_F (char *) attr_normalize LDAP_P(( char *s ));
LIBSLAPD_F (int) attr_merge LDAP_P(( Entry *e, const char *type,
struct berval **vals ));
LIBSLAPD_F (int) attr_merge_fast LDAP_P(( Entry *e, const char *type,
struct berval **vals, int nvals, int naddvals, int *maxvals,
Attribute ***a ));
LIBSLAPD_F (Attribute *) attr_find LDAP_P(( Attribute *a, const char *type ));
LIBSLAPD_F (int) attr_delete LDAP_P(( Attribute **attrs, const char *type ));
LIBSLAPD_F (int) attr_syntax LDAP_P(( const char *type ));
@ -143,6 +143,7 @@ LIBSLAPD_F (Attribute *) attrs_dup LDAP_P(( Attribute *a ));
LIBSLAPD_F (int) get_ava LDAP_P((
BerElement *ber,
AttributeAssertion **ava,
unsigned usage,
char **text ));
LIBSLAPD_F (void) ava_free LDAP_P((
AttributeAssertion *ava,
@ -662,11 +663,19 @@ LIBSLAPD_F (char *) suffix_alias LDAP_P(( Backend *be, char *ndn ));
* value.c
*/
#ifdef SLAPD_SCHEMA_NOT_COMPAT
LIBSLAPD_F (int) value_normalize LDAP_P((
AttributeDescription *ad,
unsigned usage,
struct berval *val,
char ** text ));
#else
LIBSLAPD_F (int) value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals, int naddvals, int *maxvals ));
LIBSLAPD_F (int) value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
LIBSLAPD_F (void) value_normalize LDAP_P(( char *s, int syntax ));
LIBSLAPD_F (int) value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int normalize ));
LIBSLAPD_F (int) value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax, int normalize ));
#endif
/*
* user.c

View file

@ -18,38 +18,6 @@
#include "slap.h"
int
value_add_fast(
struct berval ***vals,
struct berval **addvals,
int nvals,
int naddvals,
int *maxvals
)
{
int need, i, j;
if ( *maxvals == 0 ) {
*maxvals = 1;
}
need = nvals + naddvals + 1;
while ( *maxvals < need ) {
*maxvals *= 2;
*vals = (struct berval **) ch_realloc( (char *) *vals,
*maxvals * sizeof(struct berval *) );
}
for ( i = 0, j = 0; i < naddvals; i++ ) {
if ( addvals[i]->bv_len > 0 ) {
(*vals)[nvals + j] = ber_bvdup( addvals[i] );
if( (*vals)[nvals + j] != NULL ) j++;
}
}
(*vals)[nvals + j] = NULL;
return( 0 );
}
int
value_add(
struct berval ***vals,
@ -85,6 +53,52 @@ value_add(
#ifdef SLAPD_SCHEMA_NOT_COMPAT
/* not yet implemented */
#else
int
value_add_fast(
struct berval ***vals,
struct berval **addvals,
int nvals,
int naddvals,
int *maxvals
)
{
int need, i, j;
if ( *maxvals == 0 ) {
*maxvals = 1;
}
need = nvals + naddvals + 1;
while ( *maxvals < need ) {
*maxvals *= 2;
*vals = (struct berval **) ch_realloc( (char *) *vals,
*maxvals * sizeof(struct berval *) );
}
for ( i = 0, j = 0; i < naddvals; i++ ) {
if ( addvals[i]->bv_len > 0 ) {
(*vals)[nvals + j] = ber_bvdup( addvals[i] );
if( (*vals)[nvals + j] != NULL ) j++;
}
}
(*vals)[nvals + j] = NULL;
return( 0 );
}
#endif
#ifdef SLAPD_SCHEMA_NOT_COMPAT
int
value_normalize(
AttributeDescription *ad,
unsigned usage,
struct berval *val,
char **text )
{
/* not yet implemented */
return LDAP_SUCCESS;
}
#else
void
value_normalize(
@ -112,7 +126,11 @@ value_normalize(
}
*d = '\0';
}
#endif
#ifdef SLAPD_SCHEMA_NOT_COMPAT
/* not yet implemented */
#else
int
value_cmp(
struct berval *v1,