1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

ldb_tdb: Build a key value operation library

This allows sharing of the originally ldb_tdb operations to the new
ldb_mdb backend.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Mar  6 01:39:16 CET 2018 on sn-devel-144
This commit is contained in:
Garming Sam 2018-02-16 13:26:46 +13:00 committed by Andrew Bartlett
parent e3d364a99b
commit 4014499b12
4 changed files with 75 additions and 12 deletions

View File

@ -2058,9 +2058,9 @@ int init_store(struct ltdb_private *ltdb,
/*
connect to the database
*/
static int ltdb_connect(struct ldb_context *ldb, const char *url,
unsigned int flags, const char *options[],
struct ldb_module **_module)
int ltdb_connect(struct ldb_context *ldb, const char *url,
unsigned int flags, const char *options[],
struct ldb_module **_module)
{
const char *path;
int tdb_flags, open_flags;
@ -2146,9 +2146,3 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
return init_store(ltdb, "ldb_tdb backend", ldb, options, _module);
}
int ldb_tdb_init(const char *version)
{
LDB_MODULE_CHECK_VERSION(version);
return ldb_register_backend("tdb", ltdb_connect, false);
}

View File

@ -217,3 +217,7 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
int init_store(struct ltdb_private *ltdb, const char *name,
struct ldb_context *ldb, const char *options[],
struct ldb_module **_module);
int ltdb_connect(struct ldb_context *ldb, const char *url,
unsigned int flags, const char *options[],
struct ldb_module **_module);

View File

@ -0,0 +1,59 @@
/*
ldb database library
Copyright (C) Andrew Tridgell 2004
Copyright (C) Stefan Metzmacher 2004
Copyright (C) Simo Sorce 2006-2008
Copyright (C) Matthias Dieter Wallnöfer 2009-2010
** NOTE! The following LGPL license applies to the ldb
** library. This does NOT imply that all of Samba is released
** under the LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
* Name: ldb_tdb
*
* Component: ldb tdb backend
*
* Description: core functions for tdb backend
*
* Author: Andrew Tridgell
* Author: Stefan Metzmacher
*
* Modifications:
*
* - description: make the module use asynchronous calls
* date: Feb 2006
* Author: Simo Sorce
*
* - description: make it possible to use event contexts
* date: Jan 2008
* Author: Simo Sorce
*
* - description: fix up memory leaks and small bugs
* date: Oct 2009
* Author: Matthias Dieter Wallnöfer
*/
#include "ldb_tdb.h"
#include "ldb_private.h"
int ldb_tdb_init(const char *version)
{
LDB_MODULE_CHECK_VERSION(version);
return ldb_register_backend("tdb", ltdb_connect, false);
}

View File

@ -307,14 +307,20 @@ def build(bld):
bld.SAMBA_MODULE('ldb_tdb',
bld.SUBDIR('ldb_tdb',
'''ldb_tdb.c ldb_search.c ldb_index.c
ldb_cache.c ldb_tdb_wrap.c'''),
'''ldb_tdb_init.c'''),
init_function='ldb_tdb_init',
module_init_name='ldb_init_module',
internal_module=False,
deps='tdb ldb',
deps='tdb ldb ldb_key_value',
subsystem='ldb')
bld.SAMBA_LIBRARY('ldb_key_value',
bld.SUBDIR('ldb_tdb',
'''ldb_tdb.c ldb_search.c ldb_index.c
ldb_cache.c ldb_tdb_wrap.c'''),
private_library=True,
deps='tdb ldb')
# have a separate subsystem for common/ldb.c, so it can rebuild
# for install with a different -DLDB_MODULESDIR=
bld.SAMBA_SUBSYSTEM('LIBLDB_MAIN',