mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-23 14:09:39 +08:00
SLAPD_SCHEMA_NOT_COMPAT: add framework for substr value normalization
Calls value_normalize per substr component (like old code), likely should have/call substr_normalize which takes all components at once (to allow more sophisticated normalization)
This commit is contained in:
parent
1f22c52b8a
commit
fa9f7a7d8e
@ -429,6 +429,8 @@ get_substring_filter(
|
||||
for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
|
||||
tag = ber_next_element( ber, &len, last ) )
|
||||
{
|
||||
unsigned usage;
|
||||
|
||||
rc = ber_scanf( ber, "O", &val );
|
||||
if ( rc == LBER_ERROR ) {
|
||||
rc = SLAPD_DISCONNECT;
|
||||
@ -441,15 +443,47 @@ get_substring_filter(
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
#ifdef SLAPD_SCHEMA_NOT_COMPAT
|
||||
switch ( tag ) {
|
||||
case LDAP_SUBSTRING_INITIAL:
|
||||
usage = SLAP_MR_SUBSTR_INITIAL;
|
||||
break;
|
||||
|
||||
case LDAP_SUBSTRING_ANY:
|
||||
usage = SLAP_MR_SUBSTR_ANY;
|
||||
break;
|
||||
|
||||
case LDAP_SUBSTRING_FINAL:
|
||||
usage = SLAP_MR_SUBSTR_FINAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
|
||||
Debug( LDAP_DEBUG_FILTER,
|
||||
" unknown substring choice=%ld\n",
|
||||
(long) tag, 0, 0 );
|
||||
|
||||
ber_bvfree( val );
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
rc = value_normalize( f->f_sub_desc, usage, val, text );
|
||||
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ber_bvfree( val );
|
||||
goto return_error;
|
||||
}
|
||||
#else
|
||||
|
||||
#ifndef SLAPD_SCHEMA_NOT_COMPAT
|
||||
/* we should call a substring syntax normalization routine */
|
||||
value_normalize( val->bv_val, syntax );
|
||||
/* this is bogus, value_normalize should take a berval */
|
||||
val->bv_len = strlen( val->bv_val );
|
||||
#endif
|
||||
|
||||
rc = LDAP_PROTOCOL_ERROR;
|
||||
|
||||
switch ( tag ) {
|
||||
case LDAP_SUBSTRING_INITIAL:
|
||||
Debug( LDAP_DEBUG_FILTER, " INITIAL\n", 0, 0, 0 );
|
||||
@ -457,6 +491,8 @@ get_substring_filter(
|
||||
ber_bvfree( val );
|
||||
goto return_error;
|
||||
}
|
||||
|
||||
|
||||
f->f_sub_initial = val;
|
||||
|
||||
if( fstr ) {
|
||||
|
@ -205,12 +205,21 @@ typedef int slap_mr_filter_func LDAP_P((
|
||||
typedef struct slap_matching_rule {
|
||||
LDAP_MATCHING_RULE smr_mrule;
|
||||
unsigned smr_usage;
|
||||
#define SLAP_MR_NONE 0x00U
|
||||
#define SLAP_MR_EQUALITY 0x01U
|
||||
#define SLAP_MR_APPROX 0x02U
|
||||
#define SLAP_MR_ORDERING 0x04U
|
||||
#define SLAP_MR_SUBSTR 0x08U
|
||||
#define SLAP_MR_EXT 0x10U
|
||||
|
||||
#define SLAP_MR_TYPE_MASK 0xFF00U
|
||||
#define SLAP_MR_SUBTYPE_MASK 0x00FFU
|
||||
|
||||
#define SLAP_MR_NONE 0x0000U
|
||||
#define SLAP_MR_EQUALITY 0x0100U
|
||||
#define SLAP_MR_APPROX 0x0200U
|
||||
#define SLAP_MR_ORDERING 0x0400U
|
||||
#define SLAP_MR_SUBSTR 0x0800U
|
||||
#define SLAP_MR_EXT 0x1000U
|
||||
|
||||
#define SLAP_MR_SUBSTR_INITIAL (SLAP_MR_SUBSTR | 0x0001U )
|
||||
#define SLAP_MR_SUBSTR_ANY (SLAP_MR_SUBSTR | 0x0002U )
|
||||
#define SLAP_MR_SUBSTR_FINAL (SLAP_MR_SUBSTR | 0x0004U )
|
||||
|
||||
Syntax *smr_syntax;
|
||||
slap_mr_convert_func *smr_convert;
|
||||
slap_mr_normalize_func *smr_normalize;
|
||||
|
Loading…
Reference in New Issue
Block a user