net: Fix messaging_init for clustering
authorVolker Lendecke <vl@samba.org>
Mon, 15 Jun 2015 12:14:43 +0000 (12:14 +0000)
committerMichael Adam <obnox@samba.org>
Mon, 15 Jun 2015 20:44:56 +0000 (22:44 +0200)
A full loadparm with include=registry implicitly initializes a
messaging_context. We need to use that.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Jun 15 22:44:57 CEST 2015 on sn-devel-104

source3/utils/net.c

index ceaf5da939a879e375abb54259829ce660e2638a..4a8fad1ba0d8bd85d50cfdbf877d46392ed73e11 100644 (file)
@@ -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));