s3:dbwrap: initialize messaging before getting the ctdb connection
authorRalph Boehme <slow@samba.org>
Sat, 4 May 2019 10:12:04 +0000 (12:12 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 24 Oct 2019 08:12:27 +0000 (08:12 +0000)
This is a better fix for bug #13465.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/dbwrap/dbwrap_open.c

index c8dfd9103a85a688c266c76ca7e64b861dbfdfab..20084bca471744b899bc9a0d5f4c8307b35771aa 100644 (file)
@@ -141,13 +141,19 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                        struct messaging_context *msg_ctx;
                        struct ctdbd_connection *conn;
 
+                       /*
+                        * Initialize messaging before getting the ctdb
+                        * connection, as the ctdb connection requires messaging
+                        * to be initialized.
+                        */
+                       msg_ctx = global_messaging_context();
+
                        conn = messaging_ctdb_connection();
                        if (conn == NULL) {
                                DBG_WARNING("No ctdb connection\n");
                                errno = EIO;
                                return NULL;
                        }
-                       msg_ctx = global_messaging_context();
 
                        result = db_open_ctdb(mem_ctx, msg_ctx, base,
                                              hash_size,