From: Gary Lockyer Date: Tue, 6 Mar 2018 02:11:23 +0000 (+1300) Subject: ldb: Add MDB support to ldb:// X-Git-Tag: ldb-1.4.0~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=866af3270db8076898fb69bddd6f3699cac9e263;p=thirdparty%2Fsamba.git ldb: Add MDB support to ldb:// Signed-off-by: Gary Lockyer Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- diff --git a/lib/ldb/ldb_ldb/ldb_ldb.c b/lib/ldb/ldb_ldb/ldb_ldb.c index 3e4398f5c17..a5a36121a9f 100644 --- a/lib/ldb/ldb_ldb/ldb_ldb.c +++ b/lib/ldb/ldb_ldb/ldb_ldb.c @@ -19,6 +19,9 @@ */ #include "ldb_private.h" #include "../ldb_tdb/ldb_tdb.h" +#ifdef HAVE_LMDB +#include "../ldb_mdb/ldb_mdb.h" +#endif /* HAVE_LMDB */ /* connect to the database @@ -50,6 +53,22 @@ static int lldb_connect(struct ldb_context *ldb, * Don't create the database if it's not there */ flags |= LDB_FLG_DONT_CREATE_DB; +#ifdef HAVE_LMDB + /* + * Try opening the database as an lmdb + */ + ret = lmdb_connect(ldb, path, flags, options, module); + if (ret == LDB_SUCCESS) { + return ret; + } + if (ret != LDB_ERR_UNAVAILABLE) { + return ret; + } + + /* + * Not mdb so try as tdb + */ +#endif /* HAVE_LMDB */ ret = ltdb_connect(ldb, path, flags, options, module); return ret; }