[PATCH] net: Fix messaging_init for clustering

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Jun 15 09:30:50 MDT 2015


Hi!

Review&push appreciated!

Thanks,

Volker

-- 
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 at sernet.de
-------------- next part --------------
From 298ff4dcae9a3064c9c2931cd0f1974332fe9373 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Mon, 15 Jun 2015 12:14:43 +0000
Subject: [PATCH] net: Fix messaging_init for clustering

A full loadparm with include=registry implicitly initializes a
messaging_context. We need to use that.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/utils/net.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/source3/utils/net.c b/source3/utils/net.c
index ceaf5da..4a8fad1 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -889,7 +889,23 @@ static struct functable net_func[] = {
 		}
 	}
 
-	lp_load_global(get_dyn_CONFIGFILE());
+	if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
+		d_fprintf(stderr, "Can't load %s - run testparm to debug it\n",
+			  get_dyn_CONFIGFILE());
+		exit(1);
+	}
+
+	/*
+	 * Failing to init the msg_ctx isn't a fatal error. Only root-level
+	 * things (joining/leaving domains etc.) will be denied.
+	 */
+	c->msg_ctx = messaging_init(c, samba_tevent_context_init(c));
+
+	if (!lp_load_global(get_dyn_CONFIGFILE())) {
+		d_fprintf(stderr, "Can't load %s - run testparm to debug it\n",
+			  get_dyn_CONFIGFILE());
+		exit(1);
+	}
 
 #if defined(HAVE_BIND_TEXTDOMAIN_CODESET)
 	/* Bind our gettext results to 'unix charset'
@@ -953,11 +969,6 @@ static struct functable net_func[] = {
 
 	popt_burn_cmdline_password(argc, argv);
 
-	/* Failing to init the msg_ctx isn't a fatal error. Only
-	   root-level things (joining/leaving domains etc.) will be denied. */
-
-	c->msg_ctx = messaging_init(c, samba_tevent_context_init(c));
-
 	rc = net_run_function(c, argc_new-1, argv_new+1, "net", net_func);
 
 	DEBUG(2,("return code = %d\n", rc));
-- 
1.9.1



More information about the samba-technical mailing list