diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 26 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 7 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_private.h | 4 |
4 files changed, 39 insertions, 0 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 03622ce5a1..34d64ebb7a 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -34,6 +34,7 @@ #define TEVENT_DEPRECATED 1 #include "ldb_private.h" +#include "ldb.h" static int ldb_context_destructor(void *ptr) { @@ -1071,6 +1072,7 @@ int ldb_build_search_req_ex(struct ldb_request **ret_req, if (parent) { req->handle->nesting++; + req->handle->parent = parent; } *ret_req = req; @@ -1435,6 +1437,7 @@ int ldb_search(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, res, ldb_search_default_callback, NULL); + ldb_req_set_location(req, "ldb_search"); if (ret != LDB_SUCCESS) goto done; @@ -1478,6 +1481,7 @@ int ldb_add(struct ldb_context *ldb, NULL, ldb_op_default_callback, NULL); + ldb_req_set_location(req, "ldb_add"); if (ret != LDB_SUCCESS) return ret; @@ -1508,6 +1512,7 @@ int ldb_modify(struct ldb_context *ldb, NULL, ldb_op_default_callback, NULL); + ldb_req_set_location(req, "ldb_modify"); if (ret != LDB_SUCCESS) return ret; @@ -1533,6 +1538,7 @@ int ldb_delete(struct ldb_context *ldb, struct ldb_dn *dn) NULL, ldb_op_default_callback, NULL); + ldb_req_set_location(req, "ldb_delete"); if (ret != LDB_SUCCESS) return ret; @@ -1559,6 +1565,7 @@ int ldb_rename(struct ldb_context *ldb, NULL, ldb_op_default_callback, NULL); + ldb_req_set_location(req, "ldb_rename"); if (ret != LDB_SUCCESS) return ret; @@ -1783,3 +1790,22 @@ void ldb_set_flags(struct ldb_context *ldb, unsigned flags) { ldb->flags = flags; } + + +/* + set the location in a ldb request. Used for debugging + */ +void ldb_req_set_location(struct ldb_request *req, const char *location) +{ + if (req && req->handle) { + req->handle->location = location; + } +} + +/* + return the location set with dsdb_req_set_location + */ +const char *ldb_req_location(struct ldb_request *req) +{ + return req->handle->location; +} diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index a0e8b7e5c9..dc0ce91ecd 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -711,6 +711,8 @@ struct ldb_handle *ldb_handle_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb) h->state = LDB_ASYNC_INIT; h->ldb = ldb; h->flags = 0; + h->location = NULL; + h->parent = NULL; return h; } diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 55a6fd1c37..4bc793b9cc 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -2132,4 +2132,11 @@ struct ldb_dn *ldb_dn_binary_from_ldb_val(TALLOC_CTX *mem_ctx, int ldb_dn_get_binary(struct ldb_dn *dn, struct ldb_val *val); int ldb_dn_set_binary(struct ldb_dn *dn, struct ldb_val *val); +/* debugging functions for ldb requests */ +void ldb_req_set_location(struct ldb_request *req, const char *location); +const char *ldb_req_location(struct ldb_request *req); + +/* set the location marker on a request handle - used for debugging */ +#define LDB_REQ_SET_LOCATION(req) ldb_req_set_location(req, __location__) + #endif diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index 6bbcfa280d..c8efb6bbc5 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -55,6 +55,10 @@ struct ldb_handle { struct ldb_context *ldb; unsigned flags; unsigned nesting; + + /* used for debugging */ + struct ldb_request *parent; + const char *location; }; /* basic module structure */ |