get_ava(
BerElement *ber,
AttributeAssertion **ava,
+ unsigned usage,
char **text
)
{
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;
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",
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 );
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;
}
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
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;
}
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,
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 ));
LIBSLAPD_F (int) get_ava LDAP_P((
BerElement *ber,
AttributeAssertion **ava,
+ unsigned usage,
char **text ));
LIBSLAPD_F (void) ava_free LDAP_P((
AttributeAssertion *ava,
* 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
#include "slap.h"
+int
+value_add(
+ struct berval ***vals,
+ struct berval **addvals
+)
+{
+ int n, nn, i, j;
+
+ for ( nn = 0; addvals != NULL && addvals[nn] != NULL; nn++ )
+ ; /* NULL */
+
+ if ( *vals == NULL ) {
+ *vals = (struct berval **) ch_malloc( (nn + 1)
+ * sizeof(struct berval *) );
+ n = 0;
+ } else {
+ for ( n = 0; (*vals)[n] != NULL; n++ )
+ ; /* NULL */
+ *vals = (struct berval **) ch_realloc( (char *) *vals,
+ (n + nn + 1) * sizeof(struct berval *) );
+ }
+
+ for ( i = 0, j = 0; i < nn; i++ ) {
+ if ( addvals[i]->bv_len > 0 ) {
+ (*vals)[n + j] = ber_bvdup( addvals[i] );
+ if( (*vals)[n + j++] == NULL ) break;
+ }
+ }
+ (*vals)[n + j] = NULL;
+
+ return( 0 );
+}
+
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ /* not yet implemented */
+#else
int
value_add_fast(
struct berval ***vals,
return( 0 );
}
+#endif
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
int
-value_add(
- struct berval ***vals,
- struct berval **addvals
-)
+value_normalize(
+ AttributeDescription *ad,
+ unsigned usage,
+ struct berval *val,
+ char **text )
{
- int n, nn, i, j;
-
- for ( nn = 0; addvals != NULL && addvals[nn] != NULL; nn++ )
- ; /* NULL */
-
- if ( *vals == NULL ) {
- *vals = (struct berval **) ch_malloc( (nn + 1)
- * sizeof(struct berval *) );
- n = 0;
- } else {
- for ( n = 0; (*vals)[n] != NULL; n++ )
- ; /* NULL */
- *vals = (struct berval **) ch_realloc( (char *) *vals,
- (n + nn + 1) * sizeof(struct berval *) );
- }
-
- for ( i = 0, j = 0; i < nn; i++ ) {
- if ( addvals[i]->bv_len > 0 ) {
- (*vals)[n + j] = ber_bvdup( addvals[i] );
- if( (*vals)[n + j++] == NULL ) break;
- }
- }
- (*vals)[n + j] = NULL;
-
- return( 0 );
+ /* not yet implemented */
+ return LDAP_SUCCESS;
}
-#ifdef SLAPD_SCHEMA_NOT_COMPAT
- /* not yet implemented */
#else
void
value_normalize(
}
*d = '\0';
}
+#endif
+#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ /* not yet implemented */
+#else
int
value_cmp(
struct berval *v1,