From: Hallvard Furuseth Date: Sun, 19 Jul 2015 19:44:02 +0000 (+0200) Subject: ITS#7377 Catch mdb_put() to blocked/read-only txns X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4dea7d44fa612c74a3e521aae52228c5f2fc81f9;p=openldap ITS#7377 Catch mdb_put() to blocked/read-only txns ...early enough that txn state is left unchanged. --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 532d94a7d7..39d890e2d5 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -8602,6 +8602,9 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, if (flags & ~(MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP)) return EINVAL; + if (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED)) + return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; + mdb_cursor_init(&mc, txn, dbi, &mx); return mdb_cursor_put(&mc, key, data, flags); }