diff --git a/lib/ldb/ABI/ldb-1.1.29.sigs b/lib/ldb/ABI/ldb-1.1.29.sigs index 5e84b0ac074..ef9c53e1a4e 100644 --- a/lib/ldb/ABI/ldb-1.1.29.sigs +++ b/lib/ldb/ABI/ldb-1.1.29.sigs @@ -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 *) diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c index a0333826724..a3a00028711 100644 --- a/lib/ldb/common/ldb.c +++ b/lib/ldb/common/ldb.c @@ -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; diff --git a/lib/ldb/include/ldb_module.h b/lib/ldb/include/ldb_module.h index 54fa98984a9..91887de2efc 100644 --- a/lib/ldb/include/ldb_module.h +++ b/lib/ldb/include/ldb_module.h @@ -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