1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

ldb: Add ldb_handle_use_global_event_context()

This will allow the IRPC to be processed in the main event loop of the
server, not the private event context for this request

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:
Andrew Bartlett 2017-05-05 08:25:40 +02:00
parent e67d3568e5
commit c29201d6d3
3 changed files with 28 additions and 0 deletions

View File

@ -96,6 +96,7 @@ 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_handle_use_global_event_context: void (struct ldb_handle *)
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 *)
ldb_init: struct ldb_context *(TALLOC_CTX *, struct tevent_context *)

View File

@ -814,6 +814,21 @@ struct tevent_context *ldb_handle_get_event_context(struct ldb_handle *handle)
return ldb_get_event_context(handle->ldb);
}
/*
* This function forces a specific ldb handle to use the global event
* context. This allows a nested event loop to operate, so any open
* transaction also needs to be aborted.
*
* Any events on this event context will be lost
*
* This is used in Samba when sending an IRPC to another part of the
* same process instead of making a local DB modification.
*/
void ldb_handle_use_global_event_context(struct ldb_handle *handle)
{
TALLOC_FREE(handle->event_context);
}
void ldb_set_require_private_event_context(struct ldb_context *ldb)
{
ldb->require_private_event_context = true;

View File

@ -447,4 +447,16 @@ int ldb_unpack_data_only_attr_list_flags(struct ldb_context *ldb,
#define LDB_UNPACK_DATA_FLAG_NO_DN 0x0002
#define LDB_UNPACK_DATA_FLAG_NO_VALUES_ALLOC 0x0004
/*
* This function forces a specific ldb handle to use the global event
* context. This allows a nested event loop to operate, so any open
* transaction also needs to be aborted.
*
* Any events on this event context will be lost
*
* This is used in Samba when sending an IRPC to another part of the
* same process instead of making a local DB modification.
*/
void ldb_handle_use_global_event_context(struct ldb_handle *handle);
#endif