Issue 439 - bad logic in ldbm_tool_index_attr
Summary: bad logic in ldbm_tool_index_attr
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-02-04 16:31 UTC by Mark Adamson
Modified: 2014-08-01 21:06 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 Mark Adamson 2000-02-04 16:31:24 UTC
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




Comment 1 Kurt Zeilenga 2000-02-04 16:50:46 UTC
Fixed, thanks.
	- Kurt
Comment 2 Kurt Zeilenga 2000-02-07 19:24:21 UTC
changed notes
changed state Open to Closed
Comment 3 OpenLDAP project 2014-08-01 21:06:10 UTC
devel bug fixed