ldb: Add ldb_set_require_private_event_context()
authorAndrew Bartlett <abartlet@samba.org>
Fri, 12 May 2017 00:21:28 +0000 (02:21 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 31 May 2017 04:34:26 +0000 (06:34 +0200)
This will allow us to force use of the global event context for use when Samba
must make an IRPC call from within the ldb stack, to another part of the same
process

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
lib/ldb/ABI/ldb-1.1.29.sigs
lib/ldb/common/ldb.c
lib/ldb/include/ldb_module.h
lib/ldb/include/ldb_private.h

index 70688cf6ae2c2f4ec06b9478c3a74ed1ae5540e5..5e84b0ac07461996642f5b7b6033068eb10185ed 100644 (file)
@@ -239,6 +239,7 @@ ldb_set_event_context: void (struct ldb_context *, struct tevent_context *)
 ldb_set_flags: void (struct ldb_context *, unsigned int)
 ldb_set_modules_dir: void (struct ldb_context *, const char *)
 ldb_set_opaque: int (struct ldb_context *, const char *, void *)
+ldb_set_require_private_event_context: void (struct ldb_context *)
 ldb_set_timeout: int (struct ldb_context *, struct ldb_request *, int)
 ldb_set_timeout_from_prev_req: int (struct ldb_context *, struct ldb_request *, struct ldb_request *)
 ldb_set_utf8_default: void (struct ldb_context *)
index 5aec1f43f851aca7a3ed2fd04efa72849a186ab1..628e661c91b54aa831fe3c53b247169f45b9e624 100644 (file)
@@ -758,6 +758,10 @@ struct tevent_context *ldb_handle_get_event_context(struct ldb_handle *handle)
        return ldb_get_event_context(handle->ldb);
 }
 
+void ldb_set_require_private_event_context(struct ldb_context *ldb)
+{
+       ldb->require_private_event_context = true;
+}
 
 /*
   trace a ldb request
index fc8575c22d86ce60dd33d45e2e755fd0d5c2d35f..54fa98984a934c11345d3dd9d1880944a1eb9e0b 100644 (file)
@@ -199,6 +199,8 @@ typedef int (*ldb_connect_fn)(struct ldb_context *ldb, const char *url,
                              unsigned int flags, const char *options[],
                              struct ldb_module **module);
 
+void ldb_set_require_private_event_context(struct ldb_context *ldb);
+
 struct ldb_backend_ops {
        const char *name;
        ldb_connect_fn connect_fn;
index 6e82b3bf4787708ca2cd237a2afe656fd5b0aea9..8b233d3aa956823810435dbbe276e04f85b54b46 100644 (file)
@@ -140,6 +140,13 @@ struct ldb_context {
 
        struct tevent_context *ev_ctx;
 
+       /*
+        * If the backend holds locks, we must not use a global event
+        * context, so this flag will be set and ldb_handle_new() will
+        * build a new event context
+        */
+       bool require_private_event_context;
+
        bool prepare_commit_done;
 
        char *partial_debug;