]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#8760 fix regression in 0.9.19
authorHoward Chu <hyc@openldap.org>
Thu, 26 Oct 2017 18:04:37 +0000 (19:04 +0100)
committerHoward Chu <hyc@openldap.org>
Sat, 10 Oct 2020 12:10:58 +0000 (13:10 +0100)
libraries/liblmdb/mdb.c

index f3aa3c07adb4c838e33f720916dc1aba388e6217..2a04196921bd405939e9f343a63f87afab4472de 100644 (file)
@@ -11188,8 +11188,11 @@ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *db
                MDB_node *node = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]);
                if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA)
                        return MDB_INCOMPATIBLE;
-       } else if (! (rc == MDB_NOTFOUND && (flags & MDB_CREATE))) {
-               return rc;
+       } else {
+               if (rc != MDB_NOTFOUND || !(flags & MDB_CREATE))
+                       return rc;
+               if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY))
+                       return EACCES;
        }
 
        /* Done here so we cannot fail after creating a new DB */