[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-231-g4e0a619
Simo Sorce
idra at samba.org
Fri Jan 30 06:03:01 GMT 2009
The branch, master has been updated
via 4e0a61970120e10a6309251a97e660697818fa8a (commit)
via 380874ef863866c94c999ef53252b9d30df65e88 (commit)
from a5f0640bf99e6f7e38b0b1e7a7a56f8f58ec7e47 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4e0a61970120e10a6309251a97e660697818fa8a
Author: Simo Sorce <idra at samba.org>
Date: Fri Jan 30 01:01:05 2009 -0500
Fix standalone configure scripts
commit 380874ef863866c94c999ef53252b9d30df65e88
Author: Simo Sorce <idra at samba.org>
Date: Thu Jan 29 18:39:30 2009 -0500
Fix the mess with ldb includes.
Separate again the public from the private headers.
Add a new header specific for modules.
Also add service function for modules as now ldb_context and ldb_module are
opaque structures for them.
-----------------------------------------------------------------------
Summary of changes:
lib/tevent/build_macros.m4 | 1 +
source4/dsdb/repl/drepl_periodic.c | 2 +-
source4/dsdb/samdb/ldb_modules/anr.c | 41 ++++--
source4/dsdb/samdb/ldb_modules/config.mk | 2 +-
source4/dsdb/samdb/ldb_modules/instancetype.c | 23 ++--
source4/dsdb/samdb/ldb_modules/objectguid.c | 22 ++-
source4/dsdb/samdb/ldb_modules/partition.c | 2 +-
source4/dsdb/samdb/ldb_modules/ranged_results.c | 27 +++--
source4/dsdb/samdb/ldb_modules/subtree_delete.c | 16 ++-
source4/dsdb/samdb/ldb_modules/subtree_rename.c | 21 +++-
source4/dsdb/samdb/ldb_modules/update_keytab.c | 67 +++++++---
source4/lib/ldb-samba/ldif_handlers.c | 2 +-
source4/lib/ldb/build_macros.m4 | 1 +
source4/lib/ldb/common/attrib_handlers.c | 2 +-
source4/lib/ldb/common/ldb.c | 17 +++-
source4/lib/ldb/common/ldb_attributes.c | 2 +-
source4/lib/ldb/common/ldb_controls.c | 2 +-
source4/lib/ldb/common/ldb_debug.c | 2 +-
source4/lib/ldb/common/ldb_dn.c | 2 +-
source4/lib/ldb/common/ldb_ldif.c | 2 +-
source4/lib/ldb/common/ldb_match.c | 2 +-
source4/lib/ldb/common/ldb_modules.c | 37 +++++-
source4/lib/ldb/common/ldb_msg.c | 2 +-
source4/lib/ldb/common/ldb_parse.c | 2 +-
source4/lib/ldb/common/ldb_utf8.c | 2 +-
source4/lib/ldb/common/qsort.c | 2 +-
source4/lib/ldb/examples/ldbreader.c | 2 -
source4/lib/ldb/examples/ldifreader.c | 2 -
source4/lib/ldb/external/libevents.m4 | 2 +-
source4/lib/ldb/include/dlinklist.h | 4 +
source4/lib/ldb/include/ldb.h | 6 +-
source4/lib/ldb/include/ldb_includes.h | 2 -
source4/lib/ldb/include/ldb_module.h | 160 +++++++++++++++++++++++
source4/lib/ldb/include/ldb_private.h | 105 +--------------
source4/lib/ldb/ldb_ildap/ldb_ildap.c | 62 +++++----
source4/lib/ldb/ldb_ldap/ldb_ldap.c | 110 +++++++++-------
source4/lib/ldb/ldb_map/ldb_map.c | 83 ++++++++----
source4/lib/ldb/ldb_map/ldb_map_inbound.c | 72 ++++++++---
source4/lib/ldb/ldb_map/ldb_map_outbound.c | 33 ++++--
source4/lib/ldb/ldb_map/ldb_map_private.h | 2 +-
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c | 2 +-
source4/lib/ldb/ldb_tdb/ldb_cache.c | 59 ++++++---
source4/lib/ldb/ldb_tdb/ldb_index.c | 100 +++++++++-----
source4/lib/ldb/ldb_tdb/ldb_pack.c | 8 +-
source4/lib/ldb/ldb_tdb/ldb_search.c | 39 ++++--
source4/lib/ldb/ldb_tdb/ldb_tdb.c | 129 ++++++++++--------
source4/lib/ldb/ldb_tdb/ldb_tdb.h | 2 +
source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c | 2 -
source4/lib/ldb/modules/asq.c | 36 ++++--
source4/lib/ldb/modules/operational.c | 12 ++-
source4/lib/ldb/modules/paged_results.c | 19 ++-
source4/lib/ldb/modules/paged_searches.c | 27 +++--
source4/lib/ldb/modules/rdn_name.c | 26 +++--
source4/lib/ldb/modules/skel.c | 15 ++-
source4/lib/ldb/modules/sort.c | 32 ++++--
source4/lib/ldb/pyldb.c | 2 +-
source4/lib/ldb/tests/sample_module.c | 4 +-
source4/lib/ldb/tools/cmdline.c | 8 +-
source4/lib/ldb/tools/ldbadd.c | 2 +-
source4/lib/ldb/tools/ldbdel.c | 2 +-
source4/lib/ldb/tools/ldbedit.c | 2 +-
source4/lib/ldb/tools/ldbmodify.c | 2 +-
source4/lib/ldb/tools/ldbrename.c | 2 +-
source4/lib/ldb/tools/ldbsearch.c | 2 +-
source4/lib/ldb/tools/ldbtest.c | 2 +-
source4/libcli/ldap/config.mk | 2 +-
source4/libcli/ldap/ldap.h | 43 +------
source4/libcli/ldap/ldap_errors.h | 66 +++++++++
source4/libcli/security/security_token.c | 1 -
source4/libcli/util/nterr.c | 2 +-
source4/nbt_server/config.mk | 2 +-
source4/nbt_server/wins/wins_ldb.c | 1 +
source4/ntvfs/ipc/rap_server.c | 1 +
source4/ntvfs/posix/vfs_posix.c | 1 -
source4/ntvfs/posix/vfs_posix.h | 2 +-
source4/rpc_server/config.mk | 1 +
source4/smb_server/smb_samba3.c | 1 -
source4/utils/ad2oLschema.c | 2 +-
source4/utils/net/net_machinepw.c | 2 +-
source4/utils/oLschema2ldif.c | 2 +-
80 files changed, 1034 insertions(+), 579 deletions(-)
create mode 100644 source4/lib/ldb/include/ldb_module.h
create mode 100644 source4/libcli/ldap/ldap_errors.h
Changeset truncated at 500 lines:
diff --git a/lib/tevent/build_macros.m4 b/lib/tevent/build_macros.m4
index c036668..bb7fad8 100644
--- a/lib/tevent/build_macros.m4
+++ b/lib/tevent/build_macros.m4
@@ -7,6 +7,7 @@ AC_DEFUN(BUILD_WITH_SHARED_BUILD_DIR,
if test x"$with_shared_build_dir" != x; then
sharedbuilddir=$with_shared_build_dir
CFLAGS="$CFLAGS -I$with_shared_build_dir/include"
+ CPPFLAGS="$CPPFLAGS -I$with_shared_build_dir/include"
LDFLAGS="$LDFLAGS -L$with_shared_build_dir/lib"
fi
AC_SUBST(sharedbuilddir)
diff --git a/source4/dsdb/repl/drepl_periodic.c b/source4/dsdb/repl/drepl_periodic.c
index 4a6de8d..b88d2ce 100644
--- a/source4/dsdb/repl/drepl_periodic.c
+++ b/source4/dsdb/repl/drepl_periodic.c
@@ -20,10 +20,10 @@
*/
#include "includes.h"
+#include "lib/events/events.h"
#include "dsdb/samdb/samdb.h"
#include "auth/auth.h"
#include "smbd/service.h"
-#include "lib/events/events.h"
#include "lib/messaging/irpc.h"
#include "dsdb/repl/drepl_service.h"
#include "lib/ldb/include/ldb_errors.h"
diff --git a/source4/dsdb/samdb/ldb_modules/anr.c b/source4/dsdb/samdb/ldb_modules/anr.c
index 49e453f..a04f5eb 100644
--- a/source4/dsdb/samdb/ldb_modules/anr.c
+++ b/source4/dsdb/samdb/ldb_modules/anr.c
@@ -30,7 +30,7 @@
*/
#include "includes.h"
-#include "ldb_includes.h"
+#include "ldb_module.h"
#include "dsdb/samdb/samdb.h"
/**
@@ -40,11 +40,14 @@ static struct ldb_parse_tree *make_parse_list(struct ldb_module *module,
TALLOC_CTX *mem_ctx, enum ldb_parse_op op,
struct ldb_parse_tree *first_arm, struct ldb_parse_tree *second_arm)
{
+ struct ldb_context *ldb;
struct ldb_parse_tree *list;
+ ldb = ldb_module_get_ctx(module);
+
list = talloc(mem_ctx, struct ldb_parse_tree);
if (list == NULL){
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return NULL;
}
list->operation = op;
@@ -52,7 +55,7 @@ static struct ldb_parse_tree *make_parse_list(struct ldb_module *module,
list->u.list.num_elements = 2;
list->u.list.elements = talloc_array(list, struct ldb_parse_tree *, 2);
if (!list->u.list.elements) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return NULL;
}
list->u.list.elements[0] = talloc_steal(list, first_arm);
@@ -67,8 +70,11 @@ static struct ldb_parse_tree *make_match_tree(struct ldb_module *module,
TALLOC_CTX *mem_ctx, enum ldb_parse_op op,
const char *attr, const DATA_BLOB *match)
{
+ struct ldb_context *ldb;
struct ldb_parse_tree *match_tree;
+ ldb = ldb_module_get_ctx(module);
+
match_tree = talloc(mem_ctx, struct ldb_parse_tree);
/* Depending on what type of match was selected, fill in the right part of the union */
@@ -83,7 +89,7 @@ static struct ldb_parse_tree *make_match_tree(struct ldb_module *module,
match_tree->u.substring.chunks = talloc_array(match_tree, struct ldb_val *, 2);
if (match_tree->u.substring.chunks == NULL){
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return NULL;
}
match_tree->u.substring.chunks[0] = match;
@@ -120,12 +126,16 @@ static int anr_replace_value(struct anr_context *ac,
struct ldb_module *module = ac->module;
struct ldb_parse_tree *match_tree;
struct dsdb_attribute *cur;
- const struct dsdb_schema *schema = dsdb_get_schema(module->ldb);
+ const struct dsdb_schema *schema;
+ struct ldb_context *ldb;
uint8_t *p;
enum ldb_parse_op op;
+ ldb = ldb_module_get_ctx(module);
+
+ schema = dsdb_get_schema(ldb);
if (!schema) {
- ldb_asprintf_errstring(module->ldb, "no schema with which to construct anr filter");
+ ldb_asprintf_errstring(ldb, "no schema with which to construct anr filter");
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -135,7 +145,7 @@ static int anr_replace_value(struct anr_context *ac,
DATA_BLOB *match2 = talloc(mem_ctx, DATA_BLOB);
*match2 = data_blob_const(match->data+1, match->length - 1);
if (match2 == NULL){
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
match = match2;
@@ -151,7 +161,7 @@ static int anr_replace_value(struct anr_context *ac,
/* Inject an 'or' with the current tree */
tree = make_parse_list(module, mem_ctx, LDB_OP_OR, tree, match_tree);
if (tree == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
} else {
@@ -170,7 +180,7 @@ static int anr_replace_value(struct anr_context *ac,
DATA_BLOB *first_match = talloc(tree, DATA_BLOB);
DATA_BLOB *second_match = talloc(tree, DATA_BLOB);
if (!first_match || !second_match) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
*first_match = data_blob_const(match->data, p-match->data);
@@ -183,7 +193,7 @@ static int anr_replace_value(struct anr_context *ac,
first_split_filter = make_parse_list(module, ac, LDB_OP_AND, match_tree_1, match_tree_2);
if (first_split_filter == NULL){
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -192,14 +202,14 @@ static int anr_replace_value(struct anr_context *ac,
second_split_filter = make_parse_list(module, ac, LDB_OP_AND, match_tree_1, match_tree_2);
if (second_split_filter == NULL){
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
split_filters = make_parse_list(module, mem_ctx, LDB_OP_OR,
first_split_filter, second_split_filter);
if (split_filters == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -305,14 +315,17 @@ static int anr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
/* search */
static int anr_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_parse_tree *anr_tree;
struct ldb_request *down_req;
struct anr_context *ac;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
ac = talloc(req, struct anr_context);
if (!ac) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -335,7 +348,7 @@ static int anr_search(struct ldb_module *module, struct ldb_request *req)
}
ret = ldb_build_search_req_ex(&down_req,
- module->ldb, ac,
+ ldb, ac,
req->op.search.base,
req->op.search.scope,
anr_tree,
diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk
index 1c50923..01f5188 100644
--- a/source4/dsdb/samdb/ldb_modules/config.mk
+++ b/source4/dsdb/samdb/ldb_modules/config.mk
@@ -2,7 +2,7 @@
# Start MODULE ldb_objectguid
[MODULE::ldb_objectguid]
SUBSYSTEM = LIBLDB
-PRIVATE_DEPENDENCIES = LIBTALLOC LIBEVENTS LIBNDR
+PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBEVENTS LIBNDR
INIT_FUNCTION = LDB_MODULE(objectguid)
# End MODULE ldb_objectguid
################################################
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
index a8c45de..8d648d6 100644
--- a/source4/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -35,7 +35,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb_includes.h"
+#include "ldb_module.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "dsdb/samdb/samdb.h"
#include "dsdb/common/flags.h"
@@ -47,10 +47,11 @@ struct it_context {
static int it_callback(struct ldb_request *req, struct ldb_reply *ares)
{
+ struct ldb_context *ldb;
struct it_context *ac;
ac = talloc_get_type(req->context, struct it_context);
-
+ ldb = ldb_module_get_ctx(ac->module);
if (!ares) {
return ldb_module_done(ac->req, NULL, NULL,
@@ -62,7 +63,7 @@ static int it_callback(struct ldb_request *req, struct ldb_reply *ares)
}
if (ares->type != LDB_REPLY_DONE) {
- ldb_set_errstring(req->handle->ldb, "Invalid reply type!");
+ ldb_set_errstring(ldb, "Invalid reply type!");
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -74,6 +75,7 @@ static int it_callback(struct ldb_request *req, struct ldb_reply *ares)
/* add_record: add instancetype attribute */
static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_request *down_req;
struct ldb_message *msg;
struct it_context *ac;
@@ -81,9 +83,10 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
int ret;
const struct ldb_control *partition_ctrl;
const struct dsdb_control_current_partition *partition;
-
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "instancetype_add_record\n");
+ ldb = ldb_module_get_ctx(module);
+
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "instancetype_add_record\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
@@ -92,7 +95,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
if (!partition_ctrl) {
- ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
+ ldb_debug_set(ldb, LDB_DEBUG_FATAL,
"instancetype_add: no current partition control found");
return LDB_ERR_CONSTRAINT_VIOLATION;
}
@@ -111,7 +114,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
/* we have to copy the message as the caller might have it as a const */
msg = ldb_msg_copy_shallow(ac, req->op.add.message);
if (msg == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -121,18 +124,18 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
instance_type = INSTANCE_TYPE_WRITE;
if (ldb_dn_compare(partition->dn, msg->dn) == 0) {
instance_type |= INSTANCE_TYPE_IS_NC_HEAD;
- if (ldb_dn_compare(msg->dn, samdb_base_dn(module->ldb)) != 0) {
+ if (ldb_dn_compare(msg->dn, samdb_base_dn(ldb)) != 0) {
instance_type |= INSTANCE_TYPE_NC_ABOVE;
}
}
ret = ldb_msg_add_fmt(msg, "instanceType", "%u", instance_type);
if (ret != LDB_SUCCESS) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_build_add_req(&down_req, module->ldb, ac,
+ ret = ldb_build_add_req(&down_req, ldb, ac,
msg,
req->controls,
ac, it_callback,
diff --git a/source4/dsdb/samdb/ldb_modules/objectguid.c b/source4/dsdb/samdb/ldb_modules/objectguid.c
index 3d72568..46ba8eb 100644
--- a/source4/dsdb/samdb/ldb_modules/objectguid.c
+++ b/source4/dsdb/samdb/ldb_modules/objectguid.c
@@ -34,7 +34,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb_includes.h"
+#include "ldb_module.h"
#include "librpc/gen_ndr/ndr_misc.h"
#include "param/param.h"
@@ -136,6 +136,7 @@ static int og_op_callback(struct ldb_request *req, struct ldb_reply *ares)
/* add_record: add objectGUID attribute */
static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_request *down_req;
struct ldb_message_element *attribute;
struct ldb_message *msg;
@@ -147,7 +148,9 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
time_t t = time(NULL);
struct og_context *ac;
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n");
+ ldb = ldb_module_get_ctx(module);
+
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
@@ -176,7 +179,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
guid = GUID_random();
ndr_err = ndr_push_struct_blob(&v, msg,
- lp_iconv_convenience(ldb_get_opaque(module->ldb, "loadparm")),
+ lp_iconv_convenience(ldb_get_opaque(ldb, "loadparm")),
&guid,
(ndr_push_flags_fn_t)ndr_push_GUID);
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -196,7 +199,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
/* Get a sequence number from the backend */
/* FIXME: ldb_sequence_number is a semi-async call,
* make sure this function is split and a callback is used */
- ret = ldb_sequence_number(module->ldb, LDB_SEQ_NEXT, &seq_num);
+ ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &seq_num);
if (ret == LDB_SUCCESS) {
if (add_uint64_element(msg, "uSNCreated", seq_num) != 0 ||
add_uint64_element(msg, "uSNChanged", seq_num) != 0) {
@@ -204,7 +207,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
}
}
- ret = ldb_build_add_req(&down_req, module->ldb, ac,
+ ret = ldb_build_add_req(&down_req, ldb, ac,
msg,
req->controls,
ac, og_op_callback,
@@ -220,6 +223,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
/* modify_record: update timestamps */
static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_request *down_req;
struct ldb_message *msg;
int ret;
@@ -227,7 +231,9 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
uint64_t seq_num;
struct og_context *ac;
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n");
+ ldb = ldb_module_get_ctx(module);
+
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "objectguid_add_record\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
@@ -252,14 +258,14 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
}
/* Get a sequence number from the backend */
- ret = ldb_sequence_number(module->ldb, LDB_SEQ_NEXT, &seq_num);
+ ret = ldb_sequence_number(ldb, LDB_SEQ_NEXT, &seq_num);
if (ret == LDB_SUCCESS) {
if (add_uint64_element(msg, "uSNChanged", seq_num) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
}
- ret = ldb_build_mod_req(&down_req, module->ldb, ac,
+ ret = ldb_build_mod_req(&down_req, ldb, ac,
msg,
req->controls,
ac, og_op_callback,
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 0000c87..71a1b8e 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -34,7 +34,7 @@
*/
#include "includes.h"
-#include "ldb/include/ldb_includes.h"
+#include "ldb_private.h"
#include "dsdb/samdb/samdb.h"
struct partition_private_data {
diff --git a/source4/dsdb/samdb/ldb_modules/ranged_results.c b/source4/dsdb/samdb/ldb_modules/ranged_results.c
index eeb161b..8f36baa 100644
--- a/source4/dsdb/samdb/ldb_modules/ranged_results.c
+++ b/source4/dsdb/samdb/ldb_modules/ranged_results.c
@@ -29,7 +29,7 @@
* Author: Andrew Bartlett
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
struct rr_context {
struct ldb_module *module;
@@ -43,7 +43,7 @@ static struct rr_context *rr_init_context(struct ldb_module *module,
ac = talloc_zero(req, struct rr_context);
if (ac == NULL) {
- ldb_set_errstring(module->ldb, "Out of Memory");
+ ldb_set_errstring(ldb_module_get_ctx(module), "Out of Memory");
return NULL;
}
@@ -55,10 +55,12 @@ static struct rr_context *rr_init_context(struct ldb_module *module,
static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
{
+ struct ldb_context *ldb;
struct rr_context *ac;
int i, j;
ac = talloc_get_type(req->context, struct rr_context);
+ ldb = ldb_module_get_ctx(ac->module);
if (!ares) {
return ldb_module_done(ac->req, NULL, NULL,
@@ -106,7 +108,7 @@ static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
(size_t)(p - ac->req->op.search.attrs[i]));
if (!new_attr) {
- ldb_oom(ac->module->ldb);
+ ldb_oom(ldb);
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -123,7 +125,7 @@ static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
} else {
end_str = talloc_asprintf(el, "%u", end);
if (!end_str) {
- ldb_oom(ac->module->ldb);
+ ldb_oom(ldb);
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -137,7 +139,7 @@ static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
orig_num_values = el->num_values;
if ((start + end < start) || (start + end < end)) {
- ldb_asprintf_errstring(ac->module->ldb,
+ ldb_asprintf_errstring(ldb,
"range request error: start or end would overflow!");
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_UNWILLING_TO_PERFORM);
@@ -147,7 +149,7 @@ static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
el->values = talloc_array(el, struct ldb_val, (end - start) + 1);
if (!el->values) {
- ldb_oom(ac->module->ldb);
+ ldb_oom(ldb);
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -158,7 +160,7 @@ static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
}
el->name = talloc_asprintf(el, "%s;range=%u-%s", el->name, start, end_str);
if (!el->name) {
- ldb_oom(ac->module->ldb);
+ ldb_oom(ldb);
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -170,6 +172,7 @@ static int rr_search_callback(struct ldb_request *req, struct ldb_reply *ares)
/* search */
static int rr_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
int i;
unsigned int start, end;
const char **new_attrs = NULL;
@@ -178,6 +181,8 @@ static int rr_search(struct ldb_module *module, struct ldb_request *req)
struct rr_context *ac;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
/* Strip the range request from the attribute */
for (i = 0; req->op.search.attrs && req->op.search.attrs[i]; i++) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list