[PATCH] Fix bug 13465

Ralph Böhme slow at samba.org
Sat Jul 7 12:58:21 UTC 2018


On Sat, Jul 07, 2018 at 02:48:11PM +0200, Ralph Böhme via samba-technical wrote:
>On Sat, Jul 07, 2018 at 01:50:48PM +0200, Ralph Böhme via samba-technical wrote:
>>Looking... 
>
>this ones works better. messaging initialisation requires root 
>priveleges or out wrappers, neither is given in these python test. 
>
>The new version uses the same approach as smbpasswd. It passed a local 
>make test this time, full CI is currently running at: 
>
>https://gitlab.com/samba-team/devel/samba/pipelines/25313916 

and here's the patch.

-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 fc283a5e3cc84a6ad5b39c948e3f15101e26b9ed 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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/source3/utils/testparm.c b/source3/utils/testparm.c
index 8113eea0020..a67c2cf086a 100644
--- a/source3/utils/testparm.c
+++ b/source3/utils/testparm.c
@@ -661,6 +661,7 @@ static void do_per_share_checks(int s)
 		POPT_TABLEEND
 	};
 
+	struct messaging_context *msg_ctx = NULL;
 	TALLOC_CTX *frame = talloc_stackframe();
 
 	smb_init_locale();
@@ -698,6 +699,19 @@ static void do_per_share_checks(int s)
 		goto done;
 	}
 
+	msg_ctx = server_messaging_context();
+	if (msg_ctx == NULL) {
+		if (geteuid() != 0) {
+			DBG_NOTICE("Unable to initialize messaging context. "
+				   "Must be root to do that.\n");
+		} else {
+			fprintf(stderr,
+				"smbpasswd is not able to initialize the "
+				"messaging context!\n");
+			return 1;
+		}
+	}
+
 	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