attachversion() bug in sdb

Stig Venaas Stig.Venaas at uninett.no
Sun Jul 25 14:58:45 UTC 2004


I have an LDAP sdb back-end (see contrib/sdb/ldap/) that works fine
with BIND 9.2.3 but fails on the BIND 9.3.0rc2.

When I try to do a zone transfer the assertion ENSURE(*targetp != NULL);"
in dns_db_attachversion() fails. See backtrace below:

#0  0x401d9c31 in kill () from /lib/libc.so.6
#1  0x401d99f5 in raise () from /lib/libc.so.6
#2  0x401dade0 in abort () from /lib/libc.so.6
#3  0x0805827d in assertion_failed (file=0x818c62b "db.c", line=135985440,
    type=isc_assertiontype_ensure, cond=0x818f644 "*targetp != ((void *)0)")
    at main.c:148
#4  0x08091658 in dns_db_attachversion (db=0x1, source=0x0, targetp=0x818f644)
    at db.c:397
#5  0x080724ad in xfrout_ctx_create (mctx=0x81b2130, client=0x0, id=0,
    qname=0x0, qtype=40428, qclass=1258, db=0x81bcc80, ver=0x0, quota=0x0,
    stream=0x0, tsigkey=0x0, lasttsig=0x0, maxtime=0, idletime=0,
    many_answers=isc_boolean_false, xfrp=0xbfffdaf4) at xfrout.c:1229
#6  0x08071f48 in ns_xfr_start (client=0x81f36e8, reqtype=252) at xfrout.c:1134
#7  0x0805f807 in ns_query_start (client=0x81f36e8) at query.c:3474
#8  0x0804e6e1 in client_request (task=0x81f3948, event=0x81f3858)
    at client.c:1543
#9  0x08173db5 in dispatch (manager=0x81b6a40) at task.c:869
#10 0x081744ad in isc__taskmgr_dispatch () at task.c:1262
#11 0x081764a2 in evloop () at app.c:355
#12 0x081767be in isc_app_run () at app.c:547
#13 0x08059175 in main (argc=0, argv=0xbffff894) at main.c:751

AFAICS attachversion() in sdb needs to be changed. Here's the code for
dns_db_attachversion():

dns_db_attachversion(dns_db_t *db, dns_dbversion_t *source,
                     dns_dbversion_t **targetp)
{
        /*
         * Attach '*targetp' to 'source'.
         */

        REQUIRE(DNS_DB_VALID(db));
        REQUIRE((db->attributes & DNS_DBATTR_CACHE) == 0);
        REQUIRE(source != NULL);
        REQUIRE(targetp != NULL && *targetp == NULL);

        (db->methods->attachversion)(db, source, targetp);

        ENSURE(*targetp != NULL);
}

As you can see, *targetp == NULL before calling
db->methods->attachversion(). In this case that is attachversion() in
sdb.c. The code is simply:

static void
attachversion(dns_db_t *db, dns_dbversion_t *source,
              dns_dbversion_t **targetp)
{
        REQUIRE(source != NULL && source == (void *) &dummy);

        UNUSED(db);
        UNUSED(source);
        UNUSED(targetp);
        return;
}

so targetp is obviously not modified.

It seems the attachversions code in 9.2.3 is the same, but in 9.2.3
xfrout_ctx_create() doesn't use dns_db_attachversion() so the problem
doesn't turn up there.

Stig


More information about the bind-workers mailing list