summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-10-30 10:21:42 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-10-31 08:13:56 +1100
commitcc6d0decc7980028293168aee267e7610752fc80 (patch)
tree766f0800fdfb0f3fbf7e26aaecae0f38bed3957c /lib
parent42c379f0dfdeb36598bb2636aa2b6e3ca4410930 (diff)
downloadsamba-cc6d0decc7980028293168aee267e7610752fc80.tar.gz
samba-cc6d0decc7980028293168aee267e7610752fc80.tar.bz2
samba-cc6d0decc7980028293168aee267e7610752fc80.zip
ldb: Change ltdb_unpack_data to take an ldb_context
It always de-references the module to find the ldb anyway. Andrew Bartlett
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/ldb_tdb/ldb_index.c2
-rw-r--r--lib/ldb/ldb_tdb/ldb_pack.c4
-rw-r--r--lib/ldb/ldb_tdb/ldb_search.c6
-rw-r--r--lib/ldb/ldb_tdb/ldb_tdb.c2
-rw-r--r--lib/ldb/ldb_tdb/ldb_tdb.h2
5 files changed, 7 insertions, 9 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index d2ef4b89a6..50c6ded56a 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -1509,7 +1509,7 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
return -1;
}
- ret = ltdb_unpack_data(module, &data, msg);
+ ret = ltdb_unpack_data(ldb, &data, msg);
if (ret != 0) {
ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid data for index %s\n",
ldb_dn_get_linearized(msg->dn));
diff --git a/lib/ldb/ldb_tdb/ldb_pack.c b/lib/ldb/ldb_tdb/ldb_pack.c
index 7c13065aee..003be1592e 100644
--- a/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/lib/ldb/ldb_tdb/ldb_pack.c
@@ -154,18 +154,16 @@ int ltdb_pack_data(struct ldb_module *module,
Free with ltdb_unpack_data_free()
*/
-int ltdb_unpack_data(struct ldb_module *module,
+int ltdb_unpack_data(struct ldb_context *ldb,
const TDB_DATA *data,
struct ldb_message *message)
{
- struct ldb_context *ldb;
uint8_t *p;
unsigned int remaining;
unsigned int i, j;
unsigned format;
size_t len;
- ldb = ldb_module_get_ctx(module);
message->elements = NULL;
p = data->dptr;
diff --git a/lib/ldb/ldb_tdb/ldb_search.c b/lib/ldb/ldb_tdb/ldb_search.c
index 703ad6ad0e..4fb8510377 100644
--- a/lib/ldb/ldb_tdb/ldb_search.c
+++ b/lib/ldb/ldb_tdb/ldb_search.c
@@ -244,9 +244,9 @@ static int ltdb_parse_data_unpack(TDB_DATA key, TDB_DATA data,
{
struct ltdb_parse_data_unpack_ctx *ctx = private_data;
- int ret = ltdb_unpack_data(ctx->module, &data, ctx->msg);
+ struct ldb_context *ldb = ldb_module_get_ctx(ctx->module);
+ int ret = ltdb_unpack_data(ldb, &data, ctx->msg);
if (ret == -1) {
- struct ldb_context *ldb = ldb_module_get_ctx(ctx->module);
ldb_debug(ldb, LDB_DEBUG_ERROR, "Invalid data for index %*.*s\n",
(int)key.dsize, (int)key.dsize, key.dptr);
return LDB_ERR_OPERATIONS_ERROR;
@@ -440,7 +440,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
}
/* unpack the record */
- ret = ltdb_unpack_data(ac->module, &data, msg);
+ ret = ltdb_unpack_data(ldb, &data, msg);
if (ret == -1) {
talloc_free(msg);
return -1;
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.c b/lib/ldb/ldb_tdb/ldb_tdb.c
index 3c181509c3..0e7c74c640 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -693,7 +693,7 @@ int ltdb_modify_internal(struct ldb_module *module,
goto done;
}
- ret = ltdb_unpack_data(module, &tdb_data, msg2);
+ ret = ltdb_unpack_data(ldb_module_get_ctx(module), &tdb_data, msg2);
free(tdb_data.dptr);
if (ret == -1) {
ret = LDB_ERR_OTHER;
diff --git a/lib/ldb/ldb_tdb/ldb_tdb.h b/lib/ldb/ldb_tdb/ldb_tdb.h
index c89dd7f1ae..ea85ca1be7 100644
--- a/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -99,7 +99,7 @@ int ltdb_pack_data(struct ldb_module *module,
TDB_DATA *data);
void ltdb_unpack_data_free(struct ldb_module *module,
struct ldb_message *message);
-int ltdb_unpack_data(struct ldb_module *module,
+int ltdb_unpack_data(struct ldb_context *ldb,
const TDB_DATA *data,
struct ldb_message *message);