summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-01-29 18:39:30 -0500
committerSimo Sorce <idra@samba.org>2009-01-30 01:02:03 -0500
commit380874ef863866c94c999ef53252b9d30df65e88 (patch)
treeaafdb720253d5a6013e2a23a0e81b0a9b90f054b /source4/lib/ldb/modules
parenta5f0640bf99e6f7e38b0b1e7a7a56f8f58ec7e47 (diff)
downloadsamba-380874ef863866c94c999ef53252b9d30df65e88.tar.gz
samba-380874ef863866c94c999ef53252b9d30df65e88.tar.bz2
samba-380874ef863866c94c999ef53252b9d30df65e88.zip
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.
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r--source4/lib/ldb/modules/asq.c36
-rw-r--r--source4/lib/ldb/modules/operational.c12
-rw-r--r--source4/lib/ldb/modules/paged_results.c19
-rw-r--r--source4/lib/ldb/modules/paged_searches.c27
-rw-r--r--source4/lib/ldb/modules/rdn_name.c26
-rw-r--r--source4/lib/ldb/modules/skel.c15
-rw-r--r--source4/lib/ldb/modules/sort.c32
7 files changed, 117 insertions, 50 deletions
diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c
index c650970af4..475b609e41 100644
--- a/source4/lib/ldb/modules/asq.c
+++ b/source4/lib/ldb/modules/asq.c
@@ -32,7 +32,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
struct asq_context {
@@ -63,11 +63,14 @@ struct asq_context {
static struct asq_context *asq_context_init(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct asq_context *ac;
+ ldb = ldb_module_get_ctx(module);
+
ac = talloc_zero(req, struct asq_context);
if (ac == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return NULL;
}
@@ -206,9 +209,12 @@ static int asq_reqs_callback(struct ldb_request *req, struct ldb_reply *ares)
static int asq_build_first_request(struct asq_context *ac, struct ldb_request **base_req)
{
+ struct ldb_context *ldb;
const char **base_attrs;
int ret;
+ ldb = ldb_module_get_ctx(ac->module);
+
ac->req_attrs = ac->req->op.search.attrs;
ac->req_attribute = talloc_strdup(ac, ac->asq_ctrl->source_attribute);
if (ac->req_attribute == NULL)
@@ -222,7 +228,7 @@ static int asq_build_first_request(struct asq_context *ac, struct ldb_request **
base_attrs[1] = NULL;
- ret = ldb_build_search_req(base_req, ac->module->ldb, ac,
+ ret = ldb_build_search_req(base_req, ldb, ac,
ac->req->op.search.base,
LDB_SCOPE_BASE,
NULL,
@@ -239,6 +245,7 @@ static int asq_build_first_request(struct asq_context *ac, struct ldb_request **
static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated)
{
+ struct ldb_context *ldb;
struct ldb_control **saved_controls;
struct ldb_control *control;
struct ldb_dn *dn;
@@ -249,6 +256,8 @@ static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated)
return LDB_ERR_NO_SUCH_OBJECT;
}
+ ldb = ldb_module_get_ctx(ac->module);
+
el = ldb_msg_find_element(ac->base_res->message, ac->req_attribute);
/* no values found */
if (el == NULL) {
@@ -266,7 +275,7 @@ static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated)
for (i = 0; i < el->num_values; i++) {
- dn = ldb_dn_new(ac, ac->module->ldb,
+ dn = ldb_dn_new(ac, ldb,
(const char *)el->values[i].data);
if ( ! ldb_dn_validate(dn)) {
ac->asq_ret = ASQ_CTRL_INVALID_ATTRIBUTE_SYNTAX;
@@ -275,7 +284,7 @@ static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated)
}
ret = ldb_build_search_req_ex(&ac->reqs[i],
- ac->module->ldb, ac,
+ ldb, ac,
dn, LDB_SCOPE_BASE,
ac->req->op.search.tree,
ac->req_attrs,
@@ -298,9 +307,12 @@ static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated)
static int asq_search_continue(struct asq_context *ac)
{
+ struct ldb_context *ldb;
bool terminated = false;
int ret;
+ ldb = ldb_module_get_ctx(ac->module);
+
switch (ac->step) {
case ASQ_SEARCH_BASE:
@@ -312,7 +324,7 @@ static int asq_search_continue(struct asq_context *ac)
ac->step = ASQ_SEARCH_MULTI;
- return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
+ return ldb_request(ldb, ac->reqs[ac->cur_req]);
case ASQ_SEARCH_MULTI:
@@ -323,7 +335,7 @@ static int asq_search_continue(struct asq_context *ac)
return asq_search_terminate(ac);
}
- return ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
+ return ldb_request(ldb, ac->reqs[ac->cur_req]);
}
return LDB_ERR_OPERATIONS_ERROR;
@@ -331,11 +343,14 @@ static int asq_search_continue(struct asq_context *ac)
static int asq_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_request *base_req;
struct ldb_control *control;
struct asq_context *ac;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
/* check if there's a paged request control */
control = ldb_request_get_control(req, LDB_CONTROL_ASQ_OID);
if (control == NULL) {
@@ -366,16 +381,19 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req)
ac->step = ASQ_SEARCH_BASE;
- return ldb_request(module->ldb, base_req);
+ return ldb_request(ldb, base_req);
}
static int asq_init(struct ldb_module *module)
{
+ struct ldb_context *ldb;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
ret = ldb_mod_register_control(module, LDB_CONTROL_ASQ_OID);
if (ret != LDB_SUCCESS) {
- ldb_debug(module->ldb, LDB_DEBUG_WARNING, "asq: Unable to register control with rootdse!\n");
+ ldb_debug(ldb, LDB_DEBUG_WARNING, "asq: Unable to register control with rootdse!\n");
}
return ldb_next_init(module);
diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c
index 11c06c81bb..d862638389 100644
--- a/source4/lib/ldb/modules/operational.c
+++ b/source4/lib/ldb/modules/operational.c
@@ -73,7 +73,7 @@
modifiersName: not supported by w2k3?
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
/*
construct a canonical name from a message
@@ -126,8 +126,11 @@ static int operational_search_post_process(struct ldb_module *module,
struct ldb_message *msg,
const char * const *attrs)
{
+ struct ldb_context *ldb;
int i, a=0;
+ ldb = ldb_module_get_ctx(module);
+
for (a=0;attrs && attrs[a];a++) {
for (i=0;i<ARRAY_SIZE(search_sub);i++) {
if (ldb_attr_cmp(attrs[a], search_sub[i].attr) != 0) {
@@ -161,7 +164,7 @@ static int operational_search_post_process(struct ldb_module *module,
return 0;
failed:
- ldb_debug_set(module->ldb, LDB_DEBUG_WARNING,
+ ldb_debug_set(ldb, LDB_DEBUG_WARNING,
"operational_search_post_process failed for attribute '%s'\n",
attrs[a]);
return -1;
@@ -224,12 +227,15 @@ static int operational_callback(struct ldb_request *req, struct ldb_reply *ares)
static int operational_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct operational_context *ac;
struct ldb_request *down_req;
const char **search_attrs = NULL;
int i, a;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
ac = talloc(req, struct operational_context);
if (ac == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
@@ -268,7 +274,7 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req
}
}
- ret = ldb_build_search_req_ex(&down_req, module->ldb, ac,
+ ret = ldb_build_search_req_ex(&down_req, ldb, ac,
req->op.search.base,
req->op.search.scope,
req->op.search.tree,
diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c
index dfc565fef8..7d7cdf66a0 100644
--- a/source4/lib/ldb/modules/paged_results.c
+++ b/source4/lib/ldb/modules/paged_results.c
@@ -32,7 +32,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
struct message_store {
/* keep the whole ldb_reply as an optimization
@@ -290,6 +290,7 @@ static int paged_search_callback(struct ldb_request *req, struct ldb_reply *ares
static int paged_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_control *control;
struct private_data *private_data;
struct ldb_paged_control *paged_ctrl;
@@ -298,6 +299,8 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
struct paged_context *ac;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
/* check if there's a paged request control */
control = ldb_request_get_control(req, LDB_CONTROL_PAGED_RESULTS_OID);
if (control == NULL) {
@@ -310,11 +313,12 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_PROTOCOL_ERROR;
}
- private_data = talloc_get_type(module->private_data, struct private_data);
+ private_data = talloc_get_type(ldb_module_get_private(module),
+ struct private_data);
ac = talloc_zero(req, struct paged_context);
if (ac == NULL) {
- ldb_set_errstring(module->ldb, "Out of Memory");
+ ldb_set_errstring(ldb, "Out of Memory");
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -333,7 +337,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_build_search_req_ex(&search_req, module->ldb, ac,
+ ret = ldb_build_search_req_ex(&search_req, ldb, ac,
req->op.search.base,
req->op.search.scope,
req->op.search.tree,
@@ -385,9 +389,12 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
static int paged_request_init(struct ldb_module *module)
{
+ struct ldb_context *ldb;
struct private_data *data;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
data = talloc(module, struct private_data);
if (data == NULL) {
return LDB_ERR_OTHER;
@@ -395,11 +402,11 @@ static int paged_request_init(struct ldb_module *module)
data->next_free_id = 1;
data->store = NULL;
- module->private_data = data;
+ ldb_module_set_private(module, data);
ret = ldb_mod_register_control(module, LDB_CONTROL_PAGED_RESULTS_OID);
if (ret != LDB_SUCCESS) {
- ldb_debug(module->ldb, LDB_DEBUG_WARNING,
+ ldb_debug(ldb, LDB_DEBUG_WARNING,
"paged_request:"
"Unable to register control with rootdse!\n");
}
diff --git a/source4/lib/ldb/modules/paged_searches.c b/source4/lib/ldb/modules/paged_searches.c
index 56f9b1cac3..01e77cb22c 100644
--- a/source4/lib/ldb/modules/paged_searches.c
+++ b/source4/lib/ldb/modules/paged_searches.c
@@ -33,7 +33,7 @@
*/
#include "includes.h"
-#include "ldb_includes.h"
+#include "ldb_module.h"
#define PS_DEFAULT_PAGE_SIZE 500
/* 500 objects per query seem to be a decent compromise
@@ -211,10 +211,12 @@ static int ps_callback(struct ldb_request *req, struct ldb_reply *ares)
static int ps_search(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct private_data *private_data;
struct ps_context *ac;
- private_data = talloc_get_type(module->private_data, struct private_data);
+ private_data = talloc_get_type(ldb_module_get_private(module), struct private_data);
+ ldb = ldb_module_get_ctx(module);
/* check if paging is supported and if there is a any control */
if (!private_data || !private_data->paged_supported || req->controls) {
@@ -226,7 +228,7 @@ static int ps_search(struct ldb_module *module, struct ldb_request *req)
ac = talloc_zero(req, struct ps_context);
if (ac == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -241,11 +243,14 @@ static int ps_search(struct ldb_module *module, struct ldb_request *req)
static int ps_next_request(struct ps_context *ac) {
+ struct ldb_context *ldb;
struct ldb_paged_control *control;
struct ldb_control **controls;
struct ldb_request *new_req;
int ret;
+ ldb = ldb_module_get_ctx(ac->module);
+
controls = talloc_array(ac, struct ldb_control *, 2);
if (!controls) {
return LDB_ERR_OPERATIONS_ERROR;
@@ -270,7 +275,7 @@ static int ps_next_request(struct ps_context *ac) {
controls[0]->data = control;
controls[1] = NULL;
- ret = ldb_build_search_req_ex(&new_req, ac->module->ldb, ac,
+ ret = ldb_build_search_req_ex(&new_req, ldb, ac,
ac->req->op.search.base,
ac->req->op.search.scope,
ac->req->op.search.tree,
@@ -324,26 +329,30 @@ static int check_supported_paged(struct ldb_request *req,
static int ps_init(struct ldb_module *module)
{
+ struct ldb_context *ldb;
static const char *attrs[] = { "supportedControl", NULL };
struct private_data *data;
struct ldb_dn *base;
int ret;
struct ldb_request *req;
+ ldb = ldb_module_get_ctx(module);
+
data = talloc(module, struct private_data);
if (data == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- module->private_data = data;
data->paged_supported = false;
- base = ldb_dn_new(module, module->ldb, "");
+ ldb_module_set_private(module, data);
+
+ base = ldb_dn_new(module, ldb, "");
if (base == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_build_search_req(&req, module->ldb, module,
+ ret = ldb_build_search_req(&req, ldb, module,
base, LDB_SCOPE_BASE,
"(objectClass=*)",
attrs, NULL,
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index 62b8ce5112..a5ffcc034a 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -36,7 +36,7 @@
* Simo Sorce Mar 2006
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
struct rename_context {
@@ -86,6 +86,7 @@ static int rdn_name_add_callback(struct ldb_request *req,
static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct ldb_request *down_req;
struct rename_context *ac;
struct ldb_message *msg;
@@ -95,7 +96,8 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
struct ldb_val rdn_val;
int i, ret;
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_add_record\n");
+ ldb = ldb_module_get_ctx(module);
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "rdn_name_add_record\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.add.message->dn)) {
@@ -141,10 +143,10 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
} else {
- a = ldb_schema_attribute_by_name(module->ldb, rdn_name);
+ a = ldb_schema_attribute_by_name(ldb, rdn_name);
for (i = 0; i < attribute->num_values; i++) {
- ret = a->syntax->comparison_fn(module->ldb, msg,
+ ret = a->syntax->comparison_fn(ldb, msg,
&rdn_val, &attribute->values[i]);
if (ret == 0) {
/* overwrite so it matches in case */
@@ -153,7 +155,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
}
}
if (i == attribute->num_values) {
- ldb_debug_set(module->ldb, LDB_DEBUG_FATAL,
+ ldb_debug_set(ldb, LDB_DEBUG_FATAL,
"RDN mismatch on %s: %s (%s)",
ldb_dn_get_linearized(msg->dn), rdn_name, rdn_val.data);
talloc_free(ac);
@@ -162,7 +164,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
}
}
- ret = ldb_build_add_req(&down_req, module->ldb, req,
+ ret = ldb_build_add_req(&down_req, ldb, req,
msg,
req->controls,
ac, rdn_name_add_callback,
@@ -205,6 +207,7 @@ static int rdn_modify_callback(struct ldb_request *req, struct ldb_reply *ares)
static int rdn_rename_callback(struct ldb_request *req, struct ldb_reply *ares)
{
+ struct ldb_context *ldb;
struct rename_context *ac;
struct ldb_request *mod_req;
const char *rdn_name;
@@ -213,6 +216,7 @@ static int rdn_rename_callback(struct ldb_request *req, struct ldb_reply *ares)
int ret;
ac = talloc_get_type(req->context, struct rename_context);
+ ldb = ldb_module_get_ctx(ac->module);
if (!ares) {
goto error;
@@ -258,7 +262,7 @@ static int rdn_rename_callback(struct ldb_request *req, struct ldb_reply *ares)
goto error;
}
- ret = ldb_build_mod_req(&mod_req, ac->module->ldb,
+ ret = ldb_build_mod_req(&mod_req, ldb,
ac, msg, NULL,
ac, rdn_modify_callback,
req);
@@ -268,7 +272,7 @@ static int rdn_rename_callback(struct ldb_request *req, struct ldb_reply *ares)
talloc_steal(mod_req, msg);
/* do the mod call */
- return ldb_request(ac->module->ldb, mod_req);
+ return ldb_request(ldb, mod_req);
error:
return ldb_module_done(ac->req, NULL, NULL,
@@ -277,11 +281,13 @@ error:
static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req)
{
+ struct ldb_context *ldb;
struct rename_context *ac;
struct ldb_request *down_req;
int ret;
- ldb_debug(module->ldb, LDB_DEBUG_TRACE, "rdn_name_rename\n");
+ ldb = ldb_module_get_ctx(module);
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "rdn_name_rename\n");
/* do not manipulate our control entries */
if (ldb_dn_is_special(req->op.rename.newdn)) {
@@ -297,7 +303,7 @@ static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req)
ac->req = req;
ret = ldb_build_rename_req(&down_req,
- module->ldb,
+ ldb,
ac,
req->op.rename.olddn,
req->op.rename.newdn,
diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c
index 0cd29ac4b7..248f9b346b 100644
--- a/source4/lib/ldb/modules/skel.c
+++ b/source4/lib/ldb/modules/skel.c
@@ -31,7 +31,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
struct private_data {
@@ -87,9 +87,13 @@ static int skel_del_trans(struct ldb_module *module)
static int skel_destructor(struct ldb_module *ctx)
{
- struct private_data *data = talloc_get_type(ctx->private_data, struct private_data);
+ struct private_data *data;
+
+ data = talloc_get_type(ldb_module_get_private(ctx), struct private_data);
+
/* put your clean-up functions here */
if (data->some_private_data) talloc_free(data->some_private_data);
+
return 0;
}
@@ -100,16 +104,19 @@ static int skel_request(struct ldb_module *module, struct ldb_request *req)
static int skel_init(struct ldb_module *module)
{
+ struct ldb_context *ldb;
struct private_data *data;
+ ldb = ldb_module_get_ctx(module);
+
data = talloc(module, struct private_data);
if (data == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
data->some_private_data = NULL;
- module->private_data = data;
+ ldb_module_set_private(module, data);
talloc_set_destructor (module, skel_destructor);
diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c
index 25e56b24c8..2b2a1ab1e3 100644
--- a/source4/lib/ldb/modules/sort.c
+++ b/source4/lib/ldb/modules/sort.c
@@ -31,7 +31,7 @@
* Author: Simo Sorce
*/
-#include "ldb_includes.h"
+#include "ldb_module.h"
struct opaque {
struct ldb_context *ldb;
@@ -104,6 +104,9 @@ static int sort_compare(struct ldb_message **msg1, struct ldb_message **msg2, vo
{
struct sort_context *ac = talloc_get_type(opaque, struct sort_context);
struct ldb_message_element *el1, *el2;
+ struct ldb_context *ldb;
+
+ ldb = ldb_module_get_ctx(ac->module);
if (!ac || ac->sort_result != 0) {
/* an error occurred previously,
@@ -122,17 +125,20 @@ static int sort_compare(struct ldb_message **msg1, struct ldb_message **msg2, vo
}
if (ac->reverse)
- return ac->a->syntax->comparison_fn(ac->module->ldb, ac, &el2->values[0], &el1->values[0]);
+ return ac->a->syntax->comparison_fn(ldb, ac, &el2->values[0], &el1->values[0]);
- return ac->a->syntax->comparison_fn(ac->module->ldb, ac, &el1->values[0], &el2->values[0]);
+ return ac->a->syntax->comparison_fn(ldb, ac, &el1->values[0], &el2->values[0]);
}
static int server_sort_results(struct sort_context *ac)
{
+ struct ldb_context *ldb;
struct ldb_reply *ares;
int i, ret;
- ac->a = ldb_schema_attribute_by_name(ac->module->ldb, ac->attributeName);
+ ldb = ldb_module_get_ctx(ac->module);
+
+ ac->a = ldb_schema_attribute_by_name(ldb, ac->attributeName);
ac->sort_result = 0;
ldb_qsort(ac->msgs, ac->num_msgs,
@@ -179,9 +185,11 @@ static int server_sort_results(struct sort_context *ac)
static int server_sort_search_callback(struct ldb_request *req, struct ldb_reply *ares)
{
struct sort_context *ac;
+ struct ldb_context *ldb;
int ret;
ac = talloc_get_type(req->context, struct sort_context);
+ ldb = ldb_module_get_ctx(ac->module);
if (!ares) {
return ldb_module_done(ac->req, NULL, NULL,
@@ -197,7 +205,7 @@ static int server_sort_search_callback(struct ldb_request *req, struct ldb_reply
ac->msgs = talloc_realloc(ac, ac->msgs, struct ldb_message *, ac->num_msgs + 2);
if (! ac->msgs) {
talloc_free(ares);
- ldb_oom(ac->module->ldb);
+ ldb_oom(ldb);
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -212,7 +220,7 @@ static int server_sort_search_callback(struct ldb_request *req, struct ldb_reply
ac->referrals = talloc_realloc(ac, ac->referrals, char *, ac->num_refs + 2);
if (! ac->referrals) {
talloc_free(ares);
- ldb_oom(ac->module->ldb);
+ ldb_oom(ldb);
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -242,8 +250,11 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
struct ldb_control **controls;
struct ldb_request *down_req;
struct sort_context *ac;
+ struct ldb_context *ldb;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
/* check if there's a paged request control */
control = ldb_request_get_control(req, LDB_CONTROL_SERVER_SORT_OID);
if (control == NULL) {
@@ -253,7 +264,7 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
ac = talloc_zero(req, struct sort_context);
if (ac == NULL) {
- ldb_oom(module->ldb);
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -291,7 +302,7 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
ac->orderingRule = sort_ctrls[0]->orderingRule;
ac->reverse = sort_ctrls[0]->reverse;
- ret = ldb_build_search_req_ex(&down_req, module->ldb, ac,
+ ret = ldb_build_search_req_ex(&down_req, ldb, ac,
req->op.search.base,
req->op.search.scope,
req->op.search.tree,
@@ -316,11 +327,14 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
static int server_sort_init(struct ldb_module *module)
{
+ struct ldb_context *ldb;
int ret;
+ ldb = ldb_module_get_ctx(module);
+
ret = ldb_mod_register_control(module, LDB_CONTROL_SERVER_SORT_OID);
if (ret != LDB_SUCCESS) {
- ldb_debug(module->ldb, LDB_DEBUG_WARNING,
+ ldb_debug(ldb, LDB_DEBUG_WARNING,
"server_sort:"
"Unable to register control with rootdse!\n");
}