Issue 7442 - Data range of index_intlen
Summary: Data range of index_intlen
Status: UNCONFIRMED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: 2.4.33
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords: has_patch, IPR_OK
Depends on:
Blocks:
 
Reported: 2012-11-17 00:19 UTC by tixu@cs.ucsd.edu
Modified: 2020-09-21 22:35 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description tixu@cs.ucsd.edu 2012-11-17 00:19:49 UTC
Full_Name: Tianyin Xu
Version: 2.4.33
OS: Ubuntu 12.04 (actually doesn't matter)
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (2607:f720:1300:1241:590b:49c:889f:7b21)


Hi, all,

I suggest to make the verbosity upon changing users' configuration settings,
especially some of the configuration specifications are not written in the
manpage. It's too strong to assume that all the users carefully read the source
code. This can save users' time to diagnose why slapd does not behave as their
expectation.

This ITS is for the "index_intlen" directive. 

---------- What the manpage says ----------

index_intlen <integer>

Specify  the  key  length  for ordered integer indices. The most
significant bytes of the binary integer will be used  for  index
keys.  The default value is 4, which provides exact indexing for
31 bit values.  A floating point representation is used to index
too large values.

------------------------------------------------------

Actually, 4 is not only the default value but also the minimum value. From the
source code, I knew the index_intlen is with the data range [4, 255]. Any
out-of-range value will be converted to the boundaries without notifying users.

Here's the patch I proposed:

--- ../openldap-2.4.33/servers/slapd/bconfig.c      2012-10-10
05:18:49.000000000 -0700
+++ servers/slapd/bconfig.c     2012-11-16 14:10:40.111362005 -0800
@@ -1754,10 +1754,16 @@
                        break;
 
                case CFG_IX_INTLEN:
-                       if ( c->value_int < SLAP_INDEX_INTLEN_DEFAULT )
+                       if ( c->value_int < SLAP_INDEX_INTLEN_DEFAULT ) {
+                                snprintf( c->cr_msg, sizeof(c->cr_msg),
"index_intlen=%d smaller than minimum value %d --> auto convert to the
minimum.",  c->value_int, SLAP_INDEX_INTLEN_DEFAULT);
+                                Debug(LDAP_DEBUG_ANY, "%s: %s.\n", c->log,
c->cr_msg, 0);
                                c->value_int = SLAP_INDEX_INTLEN_DEFAULT;
-                       else if ( c->value_int > 255 )
+                       }
+                       else if ( c->value_int > 255 ) {
+                                snprintf( c->cr_msg, sizeof(c->cr_msg),
"index_intlen=%d larger than maximum value 255 --> auto convert to the
maximum.",  c->value_int);
+                                Debug(LDAP_DEBUG_ANY, "%s: %s.\n", c->log,
c->cr_msg, 0);
                                c->value_int = 255;
+                       }
                        index_intlen = c->value_int;
                        index_intlen_strlen = SLAP_INDEX_INTLEN_STRLEN(
                                index_intlen );


Comment 1 Quanah Gibson-Mount 2017-04-13 15:22:11 UTC
changed notes
moved from Incoming to Software Bugs
Comment 2 Quanah Gibson-Mount 2017-09-07 23:25:51 UTC
changed notes
Comment 3 OpenLDAP project 2017-09-08 00:07:56 UTC
has patch; openldap-scratch
IPR not needed
Comment 4 Quanah Gibson-Mount 2017-09-08 00:07:56 UTC
changed notes