[PATCH] Fix bug 13465
Ralph Böhme
slow at samba.org
Thu Jul 5 15:00:53 UTC 2018
Hi!
Attached is a fix for bug 13465. Please review&push if happy. Thanks!
-slow
--
Ralph Boehme, Samba Team https://samba.org/
Samba Developer, SerNet GmbH https://sernet.de/en/samba/
GPG Key Fingerprint: FAE2 C608 8A24 2520 51C5
59E4 AA1E 9B71 2639 9E46
-------------- next part --------------
From 2b9c4772386e12fb39673e31f01aab1f0fc157c4 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 5 Jul 2018 14:38:59 +0200
Subject: [PATCH] s3: testparm: initialize messaging, needed for registry
config
This fixes a crash triggered by running testparm with registry config
enabled in smb.conf, eg by "include = registry".
Registry config calls db_open() and that requires messaging to be up and
running on a cluster.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13465
Signed-off-by: Ralph Boehme <slow at samba.org>
---
source3/utils/testparm.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 8113eea0020..61940959f84 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -35,6 +35,7 @@
#include "system/filesys.h"
#include "popt_common.h"
#include "lib/param/loadparm.h"
+#include "messages.h"
#include <regex.h>
@@ -646,6 +647,8 @@ static void do_per_share_checks(int s)
const char *caddr;
static int show_defaults;
static int skip_logic_checks = 0;
+ struct tevent_context *ev = NULL;
+ struct messaging_context *msg_ctx = NULL;
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -698,6 +701,27 @@ static void do_per_share_checks(int s)
goto done;
}
+ if (!lp_load_initial_only(get_dyn_CONFIGFILE())) {
+ fprintf(stderr, "Can't load %s - run testparm to debug it\n",
+ get_dyn_CONFIGFILE());
+ ret = -1;
+ goto done;
+ }
+
+ ev = samba_tevent_context_init(frame);
+ if (ev == NULL) {
+ fprintf(stderr, "samba_tevent_context_init failed\n");
+ ret = -1;
+ goto done;
+ }
+
+ msg_ctx = messaging_init(ev, ev);
+ if (msg_ctx == NULL) {
+ fprintf(stderr, "messaging_init failed\n");
+ ret = -1;
+ goto done;
+ }
+
fprintf(stderr,"Load smb config files from %s\n",config_file);
if (!lp_load_with_registry_shares(config_file)) {
--
2.13.6
More information about the samba-technical
mailing list