[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
bad logic in ldbm_tool_index_attr (ITS#439)
I am trying to get slapindex running for my LDBM backend database. The
program always returns
attribute type <name>: no indices to generate
I traced the code through, and found a bug in
servers/slapd/back-ldbm/tools.c
ldbm_tool_index_attr()
In the latest version (1.48 by Kurt) it looks like this:
at_cn = at_canonical_name( at );
if( at_cn ) {
Debug( LDAP_DEBUG_ANY,
"<= index_attr NULL (attribute type %s (%s) has no
canonical name)\n",
at->sat_oid, type, 0 );
return 0;
}
The if statement has the logic backwards: it should fail if at_cn == NULL.
In fact, if you look at the code for at_canonical_name() in
servers/slapd/attr.c, if SLAPD_SCHEMA_NOT_COMPAT is NOT defined, that
function CANNOT return a NULL pointer. The code in ldbm_tool_index_attr()
is split into 2 sections, one with SLAPD_SCHEMA_NOT_COMPAT defined and one
without. The without section could, conceivably, skip the check (but that
leaves you susceptible to changes in at_canonical_name() ).
-Mark Adamson
Carnegie Mellon Univ