ldb_mdb: Apply LMDB key length restrictions at key-value layer
commitf9a12b6433f38cfab97c0057d0e9b0d5719d864a
authorGary Lockyer <gary@catalyst.net.nz>
Tue, 6 Mar 2018 02:27:51 +0000 (6 15:27 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 23 May 2018 00:27:11 +0000 (23 02:27 +0200)
tree7854a4aec4317e678bb12c4d4604174aa1afebd3
parent53d9d4974dda96f2dcbaa29c78ef1407abfe1341
ldb_mdb: Apply LMDB key length restrictions at key-value layer

We need to enforce the GUID index mode so end-users do not get a
supprise in mid-operation and we enforce a max key length of 511 so
that the index key trunctation is done correctly.

Otherwise the DB will appear to work until a very long key (DN or
index) is used, after which it will be sad.

Because the previous ldb_lmdb_test confirmed the key length by
creating a large DN, those tests are re-worked to use the GUID index
mode.  In turn, new tests are written that create a special DN around
the maximum key length.

Finally a test is included that demonstrates that adding entries to
the LMDB DB without GUID index mode fails.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ldb_mdb/ldb_mdb.c
lib/ldb/tests/ldb_lmdb_test.c