messages_ctdb: Add messaging_ctdb_connection
authorVolker Lendecke <vl@samba.org>
Wed, 5 Jul 2017 17:13:23 +0000 (19:13 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 25 Jul 2017 15:43:18 +0000 (17:43 +0200)
This will be the replacement for messaging_ctdbd_connection(). This does not
default to initializing messaging but panics. We just don't have correct
default arguments for messaging_init. Implicit multiple messaging and event
contexts is a bug also.

It *might* be that some tools fail due to this, but this needs fixing in
different ways. See the previous commit for smbpasswd.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/lib/messages_ctdb.c
source3/lib/messages_ctdb.h

index 5bc494dcbb899ba44114734fc0f367e313f0388f..a2a7c215f2346aac7af9d09e85185963ddcb2a48 100644 (file)
@@ -258,3 +258,11 @@ bool messaging_ctdb_fde_active(struct messaging_ctdb_fde *fde)
        flags = tevent_fd_get_flags(fde->fde);
        return (flags != 0);
 }
+
+struct ctdbd_connection *messaging_ctdb_connection(void)
+{
+       if (global_ctdb_context == NULL) {
+               smb_panic("messaging not initialized\n");
+       }
+       return global_ctdb_context->conn;
+}
index 006821bfd9e53628e6c862b53b5de8e452a0c142..9d5634366d54861e54be21b26e8b8b1cd8e4d213 100644 (file)
@@ -39,4 +39,6 @@ struct messaging_ctdb_fde *messaging_ctdb_register_tevent_context(
        TALLOC_CTX *mem_ctx, struct tevent_context *ev);
 bool messaging_ctdb_fde_active(struct messaging_ctdb_fde *fde);
 
+struct ctdbd_connection *messaging_ctdb_connection(void);
+
 #endif