s4-ldb: delete empty index records
authorAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 00:14:36 +0000 (11:14 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 01:47:54 +0000 (12:47 +1100)
source4/lib/ldb/ldb_tdb/ldb_index.c

index c02e74b61db55d53bf9e3c7f9f75f0483cfe6e2a..8578e06c0de368e327ef56155f445af290514503 100644 (file)
@@ -199,6 +199,14 @@ static int ltdb_dn_list_store_full(struct ldb_module *module, struct ldb_dn *dn,
        struct ldb_message *msg;
        int ret;
 
+       if (list->count == 0) {
+               ret = ltdb_delete_noindex(module, dn);
+               if (ret == LDB_ERR_NO_SUCH_OBJECT) {
+                       return LDB_SUCCESS;
+               }
+               return ret;
+       }
+
        msg = ldb_msg_new(module);
        if (!msg) {
                ldb_module_oom(module);