]> git.sur5r.net Git - openldap/commitdiff
Change integer indexing to ordered only, no backward compatibility
authorHoward Chu <hyc@openldap.org>
Sun, 25 Nov 2007 13:19:08 +0000 (13:19 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 25 Nov 2007 13:19:08 +0000 (13:19 +0000)
servers/slapd/bconfig.c
servers/slapd/schema_init.c
servers/slapd/slap.h

index 4338eeaf96352952743c0659710384e5b7d78147..0a952f91bddce74719f5a5935b4bcc40a2e1db87 100644 (file)
@@ -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;
                        
index c4ae8762d18a586400ed587ed598d398f2a07bca..ee96f4e6868f6c7ed8d82cd2d97c737bd7c73dfd 100644 (file)
@@ -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" },
index abafe18bdd85d27afde73cbfb5656c4d51566d24..df54330758fbb26b2d65d30ff3387d6c961d4c5c 100644 (file)
@@ -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 */