[PATCH] smbstatus: always initialize a messaing context
Jeremy Allison
jra at samba.org
Tue Nov 10 17:43:03 UTC 2015
On Tue, Nov 10, 2015 at 06:09:16PM +0100, Ralph Boehme wrote:
> Hi!
>
> Just came across that smbstatus wasn't working anymore in that it
> didn't list any sessions or shares.
>
> Turns out due to recent serverid changes we always need a messaging
> context in smbstatus.
>
> Please review & push if ok. Thanks!
LGTM - pushed.
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de,mailto:kontakt@sernet.de
> From bf06c4cda30ef1ae2f63388d539f52275b35a4dd Mon Sep 17 00:00:00 2001
> From: Ralph Boehme <slow at samba.org>
> 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 <slow at samba.org>
> ---
> 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 f81ab5f..8d84537 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.5.0
>
More information about the samba-technical
mailing list