From: Howard Chu Date: Thu, 4 Apr 2013 01:26:41 +0000 (-0700) Subject: Fix d3990eb2f8b2944782604a2ca7bd52e08c58fc3e X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~89^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6beaad52129da5353fd40c0ec48e6a78c4f71a2e;p=openldap Fix d3990eb2f8b2944782604a2ca7bd52e08c58fc3e Append mode should *reject* keys that are too small. Also allow APPENDDUP in mdb_put(). --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 2d06f3b75b..513706d83e 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -4939,7 +4939,8 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data, rc = MDB_NOTFOUND; mc->mc_ki[mc->mc_top]++; } else { - rc = 0; + /* new key is <= last key */ + rc = MDB_KEYEXIST; } } } else { @@ -6918,7 +6919,7 @@ mdb_put(MDB_txn *txn, MDB_dbi dbi, return EINVAL; } - if ((flags & (MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND)) != flags) + if ((flags & (MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP)) != flags) return EINVAL; mdb_cursor_init(&mc, txn, dbi, &mx);