summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-19 12:43:10 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:07 +0200
commitdf4a6e82280845668dee6fe10f2025c9fa2b958c (patch)
treecebea2bd54ebe0e9e9efba35b687732d4d7d343a
parent6dc02e832a57a9af882bbb94dfa56bfdabb70eb8 (diff)
downloadsamba-df4a6e82280845668dee6fe10f2025c9fa2b958c.tar.gz
samba-df4a6e82280845668dee6fe10f2025c9fa2b958c.tar.bz2
samba-df4a6e82280845668dee6fe10f2025c9fa2b958c.zip
ldb: use tdb directly, not tdb_compat.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--lib/ldb-samba/ldb_wrap.c5
-rw-r--r--lib/ldb-samba/wscript_build2
-rw-r--r--lib/ldb/ldb_tdb/ldb_index.c6
-rw-r--r--lib/ldb/ldb_tdb/ldb_search.c6
-rw-r--r--lib/ldb/ldb_tdb/ldb_tdb.c4
-rw-r--r--lib/ldb/ldb_tdb/ldb_tdb.h2
-rw-r--r--lib/ldb/ldb_tdb/ldb_tdb_wrap.c6
-rwxr-xr-xlib/ldb/wscript14
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_metadata.c12
9 files changed, 30 insertions, 27 deletions
diff --git a/lib/ldb-samba/ldb_wrap.c b/lib/ldb-samba/ldb_wrap.c
index b8af8c151f..83a06743be 100644
--- a/lib/ldb-samba/ldb_wrap.c
+++ b/lib/ldb-samba/ldb_wrap.c
@@ -35,7 +35,7 @@
#include "dsdb/samdb/samdb.h"
#include "param/param.h"
#include "../lib/util/dlinklist.h"
-#include "../lib/tdb_compat/tdb_compat.h"
+#include <tdb.h>
/*
this is used to catch debug messages from ldb
@@ -320,7 +320,8 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
/*
when we fork() we need to make sure that any open ldb contexts have
- any open transactions cancelled
+ any open transactions cancelled (ntdb databases doesn't need reopening,
+ as we don't use clear_if_first).
*/
void ldb_wrap_fork_hook(void)
{
diff --git a/lib/ldb-samba/wscript_build b/lib/ldb-samba/wscript_build
index 85eb66c1b3..b0d2dcaa30 100644
--- a/lib/ldb-samba/wscript_build
+++ b/lib/ldb-samba/wscript_build
@@ -8,7 +8,7 @@ bld.SAMBA_LIBRARY('ldbsamba',
source='ldif_handlers.c',
autoproto='ldif_handlers_proto.h',
public_deps='ldb',
- deps='security ndr NDR_DRSBLOBS NDR_DNSP ldbwrap samdb-common SAMDB_SCHEMA tdb_compat pyldb-util errors',
+ deps='security ndr NDR_DRSBLOBS NDR_DNSP ldbwrap samdb-common SAMDB_SCHEMA tdb pyldb-util errors',
private_library=True
)
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index a3848eddb2..d2ef4b89a6 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -155,7 +155,7 @@ static int ltdb_dn_list_load(struct ldb_module *module,
key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
key.dsize = strlen((char *)key.dptr);
- rec = tdb_fetch_compat(ltdb->idxptr->itdb, key);
+ rec = tdb_fetch(ltdb->idxptr->itdb, key);
if (rec.dptr == NULL) {
goto normal_index;
}
@@ -261,7 +261,7 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
}
if (ltdb->idxptr->itdb == NULL) {
- ltdb->idxptr->itdb = tdb_open_compat(NULL, 1000, TDB_INTERNAL, O_RDWR, 0, NULL, NULL);
+ ltdb->idxptr->itdb = tdb_open(NULL, 1000, TDB_INTERNAL, O_RDWR, 0);
if (ltdb->idxptr->itdb == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -270,7 +270,7 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
key.dptr = discard_const_p(unsigned char, ldb_dn_get_linearized(dn));
key.dsize = strlen((char *)key.dptr);
- rec = tdb_fetch_compat(ltdb->idxptr->itdb, key);
+ rec = tdb_fetch(ltdb->idxptr->itdb, key);
if (rec.dptr != NULL) {
list2 = ltdb_index_idxptr(module, rec, false);
if (list2 == NULL) {
diff --git a/lib/ldb/ldb_tdb/ldb_search.c b/lib/ldb/ldb_tdb/ldb_search.c
index 46e2d74998..5e2050065c 100644
--- a/lib/ldb/ldb_tdb/ldb_search.c
+++ b/lib/ldb/ldb_tdb/ldb_search.c
@@ -32,7 +32,7 @@
*/
#include "ldb_tdb.h"
-#include <lib/tdb_compat/tdb_compat.h>
+#include <tdb.h>
/*
add one element to a message
@@ -224,7 +224,7 @@ static int ltdb_search_base(struct ldb_module *module, struct ldb_dn *dn)
return LDB_ERR_OPERATIONS_ERROR;
}
- tdb_data = tdb_fetch_compat(ltdb->tdb, tdb_key);
+ tdb_data = tdb_fetch(ltdb->tdb, tdb_key);
talloc_free(tdb_key.dptr);
if (!tdb_data.dptr) {
return LDB_ERR_NO_SUCH_OBJECT;
@@ -256,7 +256,7 @@ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_mes
return LDB_ERR_OPERATIONS_ERROR;
}
- tdb_data = tdb_fetch_compat(ltdb->tdb, tdb_key);
+ tdb_data = tdb_fetch(ltdb->tdb, tdb_key);
talloc_free(tdb_key.dptr);
if (!tdb_data.dptr) {
return LDB_ERR_NO_SUCH_OBJECT;
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index 3541f9109f..14ffcf418c 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -50,7 +50,7 @@
*/
#include "ldb_tdb.h"
-#include <lib/tdb_compat/tdb_compat.h>
+#include <tdb.h>
/*
prevent memory errors on callbacks
@@ -664,7 +664,7 @@ int ltdb_modify_internal(struct ldb_module *module,
return LDB_ERR_OTHER;
}
- tdb_data = tdb_fetch_compat(ltdb->tdb, tdb_key);
+ tdb_data = tdb_fetch(ltdb->tdb, tdb_key);
if (!tdb_data.dptr) {
talloc_free(tdb_key.dptr);
return ltdb_err_map(tdb_error(ltdb->tdb));
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h
index 3b87b56bfd..c89dd7f1ae 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -1,7 +1,7 @@
#include "replace.h"
#include "system/filesys.h"
#include "system/time.h"
-#include "tdb_compat.h"
+#include "tdb.h"
#include "ldb_module.h"
/* this private structure is used by the ltdb backend in the
diff --git a/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 014a756d6e..eb168098a7 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -99,6 +99,7 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
struct ldb_context *ldb)
{
struct ltdb_wrap *w;
+ struct tdb_logging_context lctx;
struct stat st;
if (stat(path, &st) == 0) {
@@ -117,7 +118,10 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
return NULL;
}
- w->tdb = tdb_open_compat(path, hash_size, tdb_flags, open_flags, mode, ltdb_log_fn, ldb);
+ lctx.log_fn = ltdb_log_fn;
+ lctx.log_private = ldb;
+ w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode,
+ &lctx, NULL);
if (w->tdb == NULL) {
talloc_free(w);
return NULL;
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index f62bdec90f..94a9682df9 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -16,24 +16,23 @@ sys.path.insert(0, srcdir + '/buildtools/wafsamba')
import wafsamba, samba_dist, Options
samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
- lib/tdb:lib/tdb lib/tdb2:lib/tdb2 lib/tdb_compat:lib/tdb_compat lib/ccan:lib/ccan lib/tevent:lib/tevent lib/popt:lib/popt
+ lib/tdb:lib/tdb lib/tdb2:lib/tdb2 lib/tdb:lib/tdb lib/ccan:lib/ccan lib/tevent:lib/tevent lib/popt:lib/popt
buildtools:buildtools''')
def set_options(opt):
opt.BUILTIN_DEFAULT('replace')
opt.PRIVATE_EXTENSION_DEFAULT('ldb', noextension='ldb')
- opt.RECURSE('lib/tdb_compat')
+ opt.RECURSE('lib/tdb')
opt.RECURSE('lib/tevent')
opt.RECURSE('lib/replace')
opt.tool_options('python') # options for disabling pyc or pyo compilation
def configure(conf):
- conf.RECURSE('lib/tdb_compat')
+ conf.RECURSE('lib/tdb')
conf.RECURSE('lib/tevent')
conf.RECURSE('lib/popt')
conf.RECURSE('lib/replace')
- conf.RECURSE('lib/tdb_compat')
conf.find_program('python', var='PYTHON')
conf.find_program('xsltproc', var='XSLTPROC')
conf.check_tool('python')
@@ -78,11 +77,10 @@ def configure(conf):
conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
def build(bld):
- bld.RECURSE('lib/tdb_compat')
bld.RECURSE('lib/tevent')
bld.RECURSE('lib/popt')
bld.RECURSE('lib/replace')
- bld.RECURSE('lib/tdb_compat')
+ bld.RECURSE('lib/tdb')
if bld.env.standalone_ldb:
private_library = False
@@ -238,14 +236,14 @@ def build(bld):
init_function='ldb_tdb_init',
module_init_name='ldb_init_module',
internal_module=False,
- deps='tdb_compat ldb',
+ deps='tdb ldb',
subsystem='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',
'common/ldb.c',
- deps='tevent tdb_compat',
+ deps='tevent tdb',
includes='include',
cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
diff --git a/source4/dsdb/samdb/ldb_modules/partition_metadata.c b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
index 76b78dd13f..8e97b52802 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_metadata.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_metadata.c
@@ -54,14 +54,14 @@ static int partition_metadata_get_uint64(struct ldb_module *module,
tdb_key.dptr = (uint8_t *)discard_const_p(char, key);
tdb_key.dsize = strlen(key);
- tdb_data = tdb_fetch_compat(tdb, tdb_key);
+ tdb_data = tdb_fetch(tdb, tdb_key);
if (!tdb_data.dptr) {
if (tdb_error(tdb) == TDB_ERR_NOEXIST) {
*value = default_value;
return LDB_SUCCESS;
} else {
return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
- tdb_errorstr_compat(tdb));
+ tdb_errorstr(tdb));
}
}
@@ -131,7 +131,7 @@ static int partition_metadata_set_uint64(struct ldb_module *module,
if (tdb_store(tdb, tdb_key, tdb_data, tdb_flag) != 0) {
talloc_free(tmp_ctx);
return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
- tdb_errorstr_compat(tdb));
+ tdb_errorstr(tdb));
}
talloc_free(tmp_ctx);
@@ -398,7 +398,7 @@ int partition_metadata_start_trans(struct ldb_module *module)
if (tdb_transaction_start(tdb) != 0) {
return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
- tdb_errorstr_compat(tdb));
+ tdb_errorstr(tdb));
}
data->metadata->in_transaction++;
@@ -430,7 +430,7 @@ int partition_metadata_prepare_commit(struct ldb_module *module)
if (tdb_transaction_prepare_commit(tdb) != 0) {
return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
- tdb_errorstr_compat(tdb));
+ tdb_errorstr(tdb));
}
return LDB_SUCCESS;
@@ -462,7 +462,7 @@ int partition_metadata_end_trans(struct ldb_module *module)
if (tdb_transaction_commit(tdb) != 0) {
return ldb_module_error(module, LDB_ERR_OPERATIONS_ERROR,
- tdb_errorstr_compat(tdb));
+ tdb_errorstr(tdb));
}
return LDB_SUCCESS;