From: Howard Chu Date: Sun, 25 Nov 2007 13:19:08 +0000 (+0000) Subject: Change integer indexing to ordered only, no backward compatibility X-Git-Tag: OPENLDAP_REL_ENG_2_4_9~20^2~394 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8a8a05d811dc82ceb6c7e15ae3b9646bbf9e4af4;p=openldap Change integer indexing to ordered only, no backward compatibility --- diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 4338eeaf96..0a952f91bd 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -1019,10 +1019,7 @@ config_generic(ConfigArgs *c) { c->value_int = index_substr_if_minlen; break; case CFG_IX_INTLEN: - if ( index_intlen ) - c->value_int = index_intlen; - else - rc = 1; + c->value_int = index_intlen; break; case CFG_SORTVALS: { ADlist *sv; @@ -1162,8 +1159,7 @@ config_generic(ConfigArgs *c) { break; case CFG_IX_INTLEN: - index_intlen = 0; - slap_schema.si_mr_integerMatch->smr_usage &= ~SLAP_MR_ORDERED_INDEX; + index_intlen = SLAP_INDEX_INTLEN_DEFAULT; break; case CFG_ACL: @@ -1510,15 +1506,10 @@ config_generic(ConfigArgs *c) { break; case CFG_IX_INTLEN: - if ( !c->value_int ) { - slap_schema.si_mr_integerMatch->smr_usage &= ~SLAP_MR_ORDERED_INDEX; - } else { - if ( c->value_int < 4 ) - c->value_int = 4; - else if ( c->value_int > 255 ) - c->value_int = 255; - slap_schema.si_mr_integerMatch->smr_usage |= SLAP_MR_ORDERED_INDEX; - } + if ( c->value_int < SLAP_INDEX_INTLEN_DEFAULT ) + c->value_int = SLAP_INDEX_INTLEN_DEFAULT; + else if ( c->value_int > 255 ) + c->value_int = 255; index_intlen = c->value_int; break; diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index c4ae8762d1..ee96f4e686 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -62,8 +62,7 @@ unsigned int index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT; unsigned int index_substr_any_len = SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT; unsigned int index_substr_any_step = SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT; -/* Default to no ordered integer indexing */ -unsigned int index_intlen = 0; +unsigned int index_intlen = SLAP_INDEX_INTLEN_DEFAULT; ldap_pvt_thread_mutex_t ad_undef_mutex; ldap_pvt_thread_mutex_t oc_undef_mutex; @@ -2130,11 +2129,6 @@ integerIndexer( BerVarray keys; int i, rc; - if ( !index_intlen ) { - return octetStringIndexer( use, flags, syntax, mr, - prefix, values, keysp, ctx ); - } - for( i=0; !BER_BVISNULL( &values[i] ); i++ ) { /* just count them */ } @@ -2210,11 +2204,6 @@ integerFilter( struct berval *value; int rc; - if ( !index_intlen ) { - return octetStringFilter( use, flags, syntax, mr, - prefix, assertedValue, keysp, ctx ); - } - value = (struct berval *) assertedValue; keys = slap_sl_malloc( sizeof( struct berval ) * 2, ctx ); @@ -4799,14 +4788,14 @@ static slap_mrule_defs_rec mrule_defs[] = { {"( 2.5.13.14 NAME 'integerMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )", - SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL, + SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_ORDERED_INDEX, NULL, NULL, NULL, integerMatch, integerIndexer, integerFilter, NULL }, {"( 2.5.13.15 NAME 'integerOrderingMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )", - SLAP_MR_ORDERING, NULL, + SLAP_MR_ORDERING | SLAP_MR_ORDERED_INDEX, NULL, NULL, NULL, integerMatch, NULL, NULL, "integerMatch" }, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index abafe18bdd..df54330758 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -252,6 +252,9 @@ typedef struct slap_ssf_set { #define SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT 4 #define SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT 2 +/* default for ordered integer index keys */ +#define SLAP_INDEX_INTLEN_DEFAULT 4 + #define SLAP_INDEX_FLAGS 0xF000UL #define SLAP_INDEX_NOSUBTYPES 0x1000UL /* don't use index w/ subtypes */ #define SLAP_INDEX_NOTAGS 0x2000UL /* don't use index w/ tags */