r8668: fixed a segv during upgrade of a very old ldb.
authorAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2005 08:06:39 +0000 (08:06 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:29:52 +0000 (13:29 -0500)
Thanks to volker for finding this one too. Keep them coming!
(This used to be commit 756796ad2ea86a9471d1b09e66b1a74c4523f6f4)

source4/lib/ldb/ldb_tdb/ldb_index.c

index 1cfebe6864f7b705d3a16d5803819c5004294907..2fb6c342279a439039d917e622253388e5232664 100644 (file)
@@ -1001,6 +1001,11 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
        /* check if the DN key has changed, perhaps due to the 
           case insensitivity of an element changing */
        key2 = ltdb_key(module, msg->dn);
+       if (key2.dptr == NULL) {
+               /* probably a corrupt record ... darn */
+               ldb_debug(module->ldb, LDB_DEBUG_ERROR, "Invalid DN in re_index: %s\n", msg->dn);
+               return 0;
+       }
        if (strcmp(key2.dptr, key.dptr) != 0) {
                tdb_delete(tdb, key);
                tdb_store(tdb, key2, data, 0);