From 52b10ff3c5b4291c2f99922016417b2c4ae215e8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 2 Oct 2009 22:39:19 +1000 Subject: Revert "s4-ldb: merged with master" This reverts commit 14c9070322d089dd96b389e8087c4f4bf1a6c7cc. --- source4/lib/ldb/ldb_tdb/ldb_search.c | 43 +++++++++++------------------------- 1 file changed, 13 insertions(+), 30 deletions(-) (limited to 'source4/lib/ldb/ldb_tdb/ldb_search.c') diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index a128d9cc0c..a089a2f826 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -232,23 +232,29 @@ static int ltdb_search_base(struct ldb_module *module, struct ldb_dn *dn) } /* - search the database for a single tdb key, returning all attributes + search the database for a single simple dn, returning all attributes in a single message return LDB_ERR_NO_SUCH_OBJECT on record-not-found and LDB_SUCCESS on success */ -int ltdb_search_dn1_key(struct ldb_module *module, - TDB_DATA tdb_key, struct ldb_message *msg) +int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg) { void *data = ldb_module_get_private(module); struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private); int ret; - TDB_DATA tdb_data; + TDB_DATA tdb_key, tdb_data; memset(msg, 0, sizeof(*msg)); + /* form the key */ + tdb_key = ltdb_key(module, dn); + if (!tdb_key.dptr) { + return LDB_ERR_OPERATIONS_ERROR; + } + tdb_data = tdb_fetch(ltdb->tdb, tdb_key); + talloc_free(tdb_key.dptr); if (!tdb_data.dptr) { return LDB_ERR_NO_SUCH_OBJECT; } @@ -266,36 +272,13 @@ int ltdb_search_dn1_key(struct ldb_module *module, } if (!msg->dn) { - return LDB_ERR_OPERATIONS_ERROR; + msg->dn = ldb_dn_copy(msg, dn); } - - return LDB_SUCCESS; -} - -/* - search the database for a single simple dn, returning all attributes - in a single message - - return LDB_ERR_NO_SUCH_OBJECT on record-not-found - and LDB_SUCCESS on success -*/ - -int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_message *msg) -{ - int ret; - TDB_DATA tdb_key; - - memset(msg, 0, sizeof(*msg)); - - /* form the key */ - tdb_key = ltdb_key(msg, dn); - if (!tdb_key.dptr) { + if (!msg->dn) { return LDB_ERR_OPERATIONS_ERROR; } - ret = ltdb_search_dn1_key(module, tdb_key, msg); - talloc_free(tdb_key.dptr); - return ret; + return LDB_SUCCESS; } /* -- cgit