mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
ldb: Add ldb_handle_get_event_context()
This will allow us to obtain a private event context for use while we hold locks in ldb_tdb, that is not shared with the global state of the application. This will ensure we do not perform other operations while we hold the lock Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
This commit is contained in:
parent
1ba6b9aae8
commit
a83df55693
@ -94,6 +94,7 @@ ldb_get_opaque: void *(struct ldb_context *, const char *)
|
||||
ldb_get_root_basedn: struct ldb_dn *(struct ldb_context *)
|
||||
ldb_get_schema_basedn: struct ldb_dn *(struct ldb_context *)
|
||||
ldb_global_init: int (void)
|
||||
ldb_handle_get_event_context: struct tevent_context *(struct ldb_handle *)
|
||||
ldb_handle_new: struct ldb_handle *(TALLOC_CTX *, struct ldb_context *)
|
||||
ldb_handler_copy: int (struct ldb_context *, void *, const struct ldb_val *, struct ldb_val *)
|
||||
ldb_handler_fold: int (struct ldb_context *, void *, const struct ldb_val *, struct ldb_val *)
|
||||
|
@ -745,6 +745,19 @@ int ldb_request_get_status(struct ldb_request *req)
|
||||
return req->handle->status;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function obtains the private event context for the handle,
|
||||
* which may have been created to avoid nested event loops during
|
||||
* ldb_tdb with the locks held
|
||||
*/
|
||||
struct tevent_context *ldb_handle_get_event_context(struct ldb_handle *handle)
|
||||
{
|
||||
if (handle->event_context != NULL) {
|
||||
return handle->event_context;
|
||||
}
|
||||
return ldb_get_event_context(handle->ldb);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
trace a ldb request
|
||||
|
@ -210,6 +210,13 @@ int ldb_register_backend(const char *url_prefix, ldb_connect_fn, bool);
|
||||
|
||||
struct ldb_handle *ldb_handle_new(TALLOC_CTX *mem_ctx, struct ldb_context *ldb);
|
||||
|
||||
/*
|
||||
* This function obtains the private event context for the handle,
|
||||
* which may have been created to avoid nested event loops during
|
||||
* ldb_tdb with the locks held
|
||||
*/
|
||||
struct tevent_context *ldb_handle_get_event_context(struct ldb_handle *handle);
|
||||
|
||||
int ldb_module_send_entry(struct ldb_request *req,
|
||||
struct ldb_message *msg,
|
||||
struct ldb_control **ctrls);
|
||||
|
@ -62,6 +62,9 @@ struct ldb_handle {
|
||||
uint32_t custom_flags;
|
||||
unsigned nesting;
|
||||
|
||||
/* Private event context (if not NULL) */
|
||||
struct tevent_context *event_context;
|
||||
|
||||
/* used for debugging */
|
||||
struct ldb_request *parent;
|
||||
const char *location;
|
||||
|
Loading…
Reference in New Issue
Block a user