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-Tag: LMDB_0.9.17~63 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8901d9cfbcbe6a8a3278040485a4481af399e3bd;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 4a2dd0a51d..b78178e4c3 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -8564,6 +8564,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); }