void value_normalize LDAP_P(( char *s, int syntax ));
int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax,
int normalize ));
-int value_ncmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int len,
- int normalize ));
int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax,
int normalize ));
*d = '\0';
}
-#define LDAP_MIN( a, b ) ((a) < (b) ? (a) : (b) )
-
int
value_cmp(
struct berval *v1,
break;
case SYNTAX_BIN:
- rc = memcmp( v1->bv_val, v2->bv_val, LDAP_MIN( v1->bv_len,
- v2->bv_len ) );
+ rc = ( v1->bv_len == v2->bv_len ) ? memcmp( v1->bv_val,
+ v2->bv_val, v1->bv_len ) : v1->bv_len - v2->bv_len ;
break;
}
return( rc );
}
-int
-value_ncmp(
- struct berval *v1,
- struct berval *v2,
- int syntax,
- int len,
- int normalize
-)
-{
- int rc;
-
- if ( normalize & 1 ) {
- v1 = ber_bvdup( v1 );
- value_normalize( v1->bv_val, syntax );
- }
- if ( normalize & 2 ) {
- v2 = ber_bvdup( v2 );
- value_normalize( v2->bv_val, syntax );
- }
-
- switch ( syntax ) {
- case SYNTAX_CIS:
- case (SYNTAX_CIS | SYNTAX_TEL):
- rc = strncasecmp( v1->bv_val, v2->bv_val, len );
- break;
-
- case SYNTAX_CES:
- rc = strncmp( v1->bv_val, v2->bv_val, len );
- break;
-
- case SYNTAX_BIN:
- rc = memcmp( v1->bv_val, v2->bv_val, len );
- }
-
- if ( normalize & 1 ) {
- ber_bvfree( v1 );
- }
- if ( normalize & 2 ) {
- ber_bvfree( v2 );
- }
-
- return( rc );
-}
-
int
value_find(
struct berval **vals,