[Date Prev][Date Next] [Chronological] [Thread] [Top]

Patch: slapadd segfaults on bad config file (ITS#1734)



Full_Name: Hallvard B. Furuseth
Version: HEAD (2002-04-08)
OS: Linux
URL: http://folk.uio.no/hbf/OpenLDAP/tool-init.txt
Submission from: (NULL) (158.36.148.34)


`slapadd -n 2' segfaults on this bad config file:

        include         /var/tmp/ldap/etc/openldap/schema/core.schema

        database        bdb
        suffix          ""
        directory       /tmp

        # should be before the suffix "" database
        database        bdb
        suffix          "dc=mysil"
        directory       /var/tmp

Program received signal SIGSEGV, Segmentation fault.
0x80855cb in backend_startup (be=0x8266794) at backend.c:248
248                     LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
249                                "backend_startup:  starting \"%s\"\n",
250                                be->be_suffix[0]->bv_val ));
(gdb) p be->be_suffix
$1 = (struct berval **) 0x0

...because read_config() returns failure (and an incomplete
configuration) but slap_tool_init() does not check the return code.
Here is a patch.  Or, if there is some reason why slap tools should
accept (some) bad config files, the return code from read_config()
needs to be split in truly bad codes and bad codes to be ignored
by slap tools.  I'll make a new patch if you tell me what the
criteria are.