]> git.sur5r.net Git - openldap/commitdiff
ITS#7517 Don't save dropped dirty MDB databases.
authorHallvard Furuseth <hallvard@openldap.org>
Sat, 16 Feb 2013 18:08:37 +0000 (19:08 +0100)
committerHallvard Furuseth <hallvard@openldap.org>
Sat, 16 Feb 2013 18:08:37 +0000 (19:08 +0100)
mdb_txn_commit's attempt to save the DB could corrupt another DB if
another thread had called mdb_dbi_open and reused the closed DBI.

libraries/liblmdb/mdb.c

index 40b9bda4847917fdeafc5275c83f1b0ca0801d82..715d1c811a266aeb8d3552b6667dbb7d39ba385a 100644 (file)
@@ -7146,8 +7146,10 @@ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del)
        /* Can't delete the main DB */
        if (del && dbi > MAIN_DBI) {
                rc = mdb_del(txn, MAIN_DBI, &mc->mc_dbx->md_name, NULL);
-               if (!rc)
+               if (!rc) {
+                       txn->mt_dbflags[dbi] = DB_STALE;
                        mdb_dbi_close(txn->mt_env, dbi);
+               }
        } else {
                /* reset the DB record, mark it dirty */
                txn->mt_dbflags[dbi] |= DB_DIRTY;