Full_Name: Tianyin Xu
Version: 2.4.30
OS: Ubuntu Linux 10.04
URL:
ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (128.54.167.68)
1. Symptom:
In the main configuration file of OpenLDAP (slapd.conf), set the following
configuration:
index_substr_if_minlen 100
index_substr_if_maxlen 5
Then, everything is fine. The system behaves as expectation. However, if reverse
the order of the two configuration line as follows:
index_substr_if_maxlen 5
index_substr_if_minlen 100
Then, the system refused to start, with the following misleading message:
Mar 25 21:29:18 tianyin-desktop slapd[12700]:
/home/tianyin/openldap-2.4.30/etc/openldap/slapd.conf: line 1:
<index_substr_if_minlen> invalid value (5)
---------------------------------------------------------
2. Root cause in terms of code snippet
(1) servers/slapd/slap.h
#define SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT 2
#define SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT 4
(2) servers/slapd/schema_init.c
unsigned int index_substr_if_minlen = SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT;
unsigned int index_substr_if_maxlen = SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT;
(3) servers/slapd/bconfig.c
case CFG_SSTR_IF_MAX:
if (c->value_uint < index_substr_if_minlen) {
snprintf(c->cr_msg, sizeof(c->cr_msg), "<%s> invalid
value",
c->argv[0]);
Debug(LDAP_DEBUG_ANY, "%s: %s (%d)\n", c->log, c->cr_msg,
c->value_int);
return(1);
}
index_substr_if_maxlen = c->value_uint;
break;
case CFG_SSTR_IF_MIN:
if (c->value_uint > index_substr_if_maxlen) {
snprintf(c->cr_msg, sizeof( c->cr_msg ), "<%s> invalid
value",
c->argv[0]);
Debug(LDAP_DEBUG_ANY, "%s: %s (%d)\n", c->log, c->cr_msg,
c->value_int
);
return(1);
}
index_substr_if_minlen = c->value_uint;
break;
(4) backtrace
#0 config_generic (c=0x915760) at bconfig.c:1996
#1 0x0000000000433a00 in config_set_vals (Conf=0x8146c0, c=0x915760) at
config.c:345
#2 0x0000000000433f5f in config_add_vals (Conf=0x8146c0, c=0x915760) at
config.c:418
#3 0x00000000004351b3 in read_config_file (fname=0x5a0a98
"/home/tianyin/openldap-2.4.30/etc/openldap/slapd.conf", depth=0, cf=0x0,
cft=0x8140c0) at config.c:783
#4 0x000000000042846b in read_config (fname=0x0, dir=0x0) at bconfig.c:4213
#5 0x000000000041c217 in main (argc=1, argv=0x7fffffffe2f8) at main.c:792
---------------------------------------------------------
It's quite clear that the order matters, and this should be a bug related to
configuration.
Thanks,
Tianyin