summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb/common/ldb.c27
-rw-r--r--source4/lib/ldb/common/ldb_modules.c14
-rw-r--r--source4/lib/ldb/include/ldb_private.h1
3 files changed, 38 insertions, 4 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index e93560e559..ba88e6cd64 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -635,7 +635,8 @@ static void ldb_trace_request(struct ldb_context *ldb, struct ldb_request *req)
case LDB_SEARCH:
ldb_debug_add(ldb, "ldb_trace_request: SEARCH\n");
ldb_debug_add(ldb, " dn: %s\n",
- ldb_dn_get_linearized(req->op.search.base));
+ ldb_dn_is_null(req->op.search.base)?"<rootDSE>":
+ ldb_dn_get_linearized(req->op.search.base));
ldb_debug_add(ldb, " scope: %s\n",
req->op.search.scope==LDB_SCOPE_BASE?"base":
req->op.search.scope==LDB_SCOPE_ONELEVEL?"one":
@@ -921,6 +922,10 @@ int ldb_build_search_req_ex(struct ldb_request **ret_req,
return LDB_ERR_OPERATIONS_ERROR;
}
+ if (parent) {
+ req->handle->nesting++;
+ }
+
*ret_req = req;
return LDB_SUCCESS;
}
@@ -988,6 +993,10 @@ int ldb_build_add_req(struct ldb_request **ret_req,
return LDB_ERR_OPERATIONS_ERROR;
}
+ if (parent) {
+ req->handle->nesting++;
+ }
+
*ret_req = req;
return LDB_SUCCESS;
@@ -1026,6 +1035,10 @@ int ldb_build_mod_req(struct ldb_request **ret_req,
return LDB_ERR_OPERATIONS_ERROR;
}
+ if (parent) {
+ req->handle->nesting++;
+ }
+
*ret_req = req;
return LDB_SUCCESS;
@@ -1064,6 +1077,10 @@ int ldb_build_del_req(struct ldb_request **ret_req,
return LDB_ERR_OPERATIONS_ERROR;
}
+ if (parent) {
+ req->handle->nesting++;
+ }
+
*ret_req = req;
return LDB_SUCCESS;
@@ -1104,6 +1121,10 @@ int ldb_build_rename_req(struct ldb_request **ret_req,
return LDB_ERR_OPERATIONS_ERROR;
}
+ if (parent) {
+ req->handle->nesting++;
+ }
+
*ret_req = req;
return LDB_SUCCESS;
@@ -1173,6 +1194,10 @@ int ldb_build_extended_req(struct ldb_request **ret_req,
return LDB_ERR_OPERATIONS_ERROR;
}
+ if (parent) {
+ req->handle->nesting++;
+ }
+
*ret_req = req;
return LDB_SUCCESS;
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 997d373653..ea29a09a2a 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -540,6 +540,8 @@ int ldb_next_request(struct ldb_module *module, struct ldb_request *request)
return LDB_ERR_UNWILLING_TO_PERFORM;
}
+ request->handle->nesting++;
+
switch (request->operation) {
case LDB_SEARCH:
FIND_OP(module, search);
@@ -570,6 +572,9 @@ int ldb_next_request(struct ldb_module *module, struct ldb_request *request)
ret = module->ops->request(module, request);
break;
}
+
+ request->handle->nesting--;
+
if (ret == LDB_SUCCESS) {
return ret;
}
@@ -672,7 +677,8 @@ int ldb_module_send_entry(struct ldb_request *req,
ares->controls = talloc_steal(ares, ctrls);
ares->error = LDB_SUCCESS;
- if (req->handle->ldb->flags & LDB_FLG_ENABLE_TRACING) {
+ if ((req->handle->ldb->flags & LDB_FLG_ENABLE_TRACING) &&
+ req->handle->nesting == 0) {
char *s;
ldb_debug_add(req->handle->ldb, "ldb_trace_response: ENTRY\n");
s = ldb_ldif_message_string(req->handle->ldb, msg, LDB_CHANGETYPE_NONE, msg);
@@ -706,7 +712,8 @@ int ldb_module_send_referral(struct ldb_request *req,
ares->referral = talloc_steal(ares, ref);
ares->error = LDB_SUCCESS;
- if (req->handle->ldb->flags & LDB_FLG_ENABLE_TRACING) {
+ if ((req->handle->ldb->flags & LDB_FLG_ENABLE_TRACING) &&
+ req->handle->nesting == 0) {
ldb_debug_add(req->handle->ldb, "ldb_trace_response: REFERRAL\n");
ldb_debug_add(req->handle->ldb, "ref: %s\n", ref);
ldb_debug_end(req->handle->ldb, LDB_DEBUG_TRACE);
@@ -744,7 +751,8 @@ int ldb_module_done(struct ldb_request *req,
req->handle->flags |= LDB_HANDLE_FLAG_DONE_CALLED;
- if (req->handle->ldb->flags & LDB_FLG_ENABLE_TRACING) {
+ if ((req->handle->ldb->flags & LDB_FLG_ENABLE_TRACING) &&
+ req->handle->nesting == 0) {
ldb_debug_add(req->handle->ldb, "ldb_trace_response: DONE\n");
ldb_debug_add(req->handle->ldb, "error: %u\n", error);
if (ldb_errstring(req->handle->ldb)) {
diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h
index b78cef969a..0e0a1a206d 100644
--- a/source4/lib/ldb/include/ldb_private.h
+++ b/source4/lib/ldb/include/ldb_private.h
@@ -54,6 +54,7 @@ struct ldb_handle {
enum ldb_state state;
struct ldb_context *ldb;
unsigned flags;
+ unsigned nesting;
};
/* basic module structure */