Meaning of NULL share names in registry?

Volker Lendecke Volker.Lendecke at SerNet.DE
Mon Apr 27 08:37:47 MDT 2015


Hi, Michael!

With bcaac7fa3632 we got a feature that we can have NULL
share names. By virtue of this we can easily crash testparm
and the srvsvc_NetShareEnum server side when such a
registry is around. Just do a

net conf setparm "" available no
testparm

to reproduce this.

What is the meaning of NULL share names in the registry? I'd
vote to ignore them at least during listing. Alternatively,
we should do what we do for the smb.conf file, namely add
the direct values in hklm\software\smbconf to [global]. But
then we have to decide which comes first: The explicit
[global] key or the smbconf key's values?

Attached find a patch that ignores NULL share names during
enumeration. Maybe the other parts of bcaac7f could go as
well when this is accepted?

Thanks for comments!

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 3bbcf4782ab059e303933007ecbf247b9650143e Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Mon, 27 Apr 2015 14:34:12 +0000
Subject: [PATCH] param: Ignore keyless smb.conf regvalues

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/lib/smbconf/smbconf_reg.c | 34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index bc878cc..e756580 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -530,29 +530,6 @@ done:
 	return err;
 }
 
-static bool smbconf_reg_key_has_values(struct registry_key *key)
-{
-	WERROR werr;
-	uint32_t num_subkeys;
-	uint32_t max_subkeylen;
-	uint32_t max_subkeysize;
-	uint32_t num_values;
-	uint32_t max_valnamelen;
-	uint32_t max_valbufsize;
-	uint32_t secdescsize;
-	NTTIME last_changed_time;
-
-	werr = reg_queryinfokey(key, &num_subkeys, &max_subkeylen,
-				&max_subkeysize, &num_values, &max_valnamelen,
-				&max_valbufsize, &secdescsize,
-				&last_changed_time);
-	if (!W_ERROR_IS_OK(werr)) {
-		return false;
-	}
-
-	return (num_values != 0);
-}
-
 /**
  * delete all values from a key
  */
@@ -806,17 +783,6 @@ static sbcErr smbconf_reg_get_share_names(struct smbconf_ctx *ctx,
 
 	tmp_ctx = talloc_stackframe();
 
-	/* if there are values in the base key, return NULL as share name */
-
-	if (smbconf_reg_key_has_values(rpd(ctx)->base_key)) {
-		err = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
-						   0, NULL);
-		if (!SBC_ERROR_IS_OK(err)) {
-			goto done;
-		}
-		added_count++;
-	}
-
 	/* make sure "global" is always listed first */
 	if (smbconf_share_exists(ctx, GLOBAL_NAME)) {
 		err = smbconf_add_string_to_array(tmp_ctx, &tmp_share_names,
-- 
1.9.1



More information about the samba-technical mailing list