From 2d6dca8797afb02083c86ec7d8d220fa6a60d333 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 10 Nov 2015 17:59:09 +0100 Subject: [PATCH] smbstatus: always initialize a messaing context Recent changes (b542ce7db394de3023b95288b0c40c4533c02cb1) to serverid code made serverid_exists() call messaging_dgm_get_unique() which means we depend on a valid messaging context that initializes global_dgm_context. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/utils/status.c | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/source3/utils/status.c b/source3/utils/status.c index f81ab5f1e22..8d84537c495 100644 --- a/source3/utils/status.c +++ b/source3/utils/status.c @@ -456,18 +456,15 @@ int main(int argc, const char *argv[]) } - if (lp_clustering()) { - /* - * This implicitly initializes the global ctdbd - * connection, usable by the db_open() calls further - * down. - */ - msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL)); - if (msg_ctx == NULL) { - fprintf(stderr, "messaging_init failed\n"); - ret = -1; - goto done; - } + /* + * This implicitly initializes the global ctdbd connection, + * usable by the db_open() calls further down. + */ + msg_ctx = messaging_init(NULL, samba_tevent_context_init(NULL)); + if (msg_ctx == NULL) { + fprintf(stderr, "messaging_init failed\n"); + ret = -1; + goto done; } if (!lp_load_global(get_dyn_CONFIGFILE())) { @@ -582,16 +579,6 @@ int main(int argc, const char *argv[]) if (show_notify) { struct notify_context *n; - if (msg_ctx == NULL) { - msg_ctx = messaging_init( - NULL, samba_tevent_context_init(NULL)); - if (msg_ctx == NULL) { - fprintf(stderr, "messaging_init failed\n"); - ret = -1; - goto done; - } - } - n = notify_init(talloc_tos(), msg_ctx, messaging_tevent_context(msg_ctx)); if (n == NULL) { -- 2.34.1