Rev 5361: Make "include = registry" effective (only in global section): in http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

Michael Adam ma at sernet.de
Sun Apr 15 22:30:37 GMT 2007


At http://samba.sernet.de/ma/bzr/SAMBA_3_0-registry.bzr/

------------------------------------------------------------
revno: 5361
revision-id: ma at sernet.de-20070415223033-c85f4b580cdebeac
parent: ma at sernet.de-20070415222354-a6c6c91479c2cd30
committer: Michael Adam <ma at sernet.de>
branch nick: SAMBA_3_0-registry.bzr
timestamp: Mon 2007-04-16 00:30:33 +0200
message:
  Make "include = registry" effective (only in global section):
  Parameters are processed by do_parameter.
  
  Currently (as with smbd/service.c:load_registry_service(),
  parameters read from registry are either type sz or type dword
  and are converted to string (in case of reg type dword).
  This conversion, which is also present in utils/net_conf.c
  should really go into one helper function...
modified:
  source/param/loadparm.c        loadparm.c-20060530022627-1efa1edb3eb0e897
=== modified file 'source/param/loadparm.c'
--- a/source/param/loadparm.c	2007-04-13 16:00:33 +0000
+++ b/source/param/loadparm.c	2007-04-15 22:30:33 +0000
@@ -3182,8 +3182,9 @@
 	char *regpath = NULL;
 	WERROR werr = WERR_OK;
 	struct registry_key *key = NULL;
-	struct registry_value *valvalue = NULL;
+	struct registry_value *value = NULL;
 	char *valname = NULL;
+	char *valstr = NULL;
 	uint32 idx = 0;
 	NT_USER_TOKEN *token;
 
@@ -3216,10 +3217,25 @@
 
 	for (idx = 0;
 	     W_ERROR_IS_OK(werr = reg_enumvalue(ctx, key, idx, &valname,
-			     			&valvalue));
+			     			&value));
 	     idx++)
 	{
-		DEBUG(1, ("got global registry parameter '%s'\n", valname));
+		DEBUG(5, ("got global registry parameter '%s'\n", valname));
+		switch(value->type) {
+		case REG_DWORD:
+			valstr = talloc_asprintf(ctx, "%d", value->v.dword);
+			pfunc(valname, valstr);
+			TALLOC_FREE(valstr);
+			break;
+		case REG_SZ:
+			pfunc(valname, value->v.sz.str);
+			break;
+		default:
+			/* ignore */
+			break;
+		}
+		TALLOC_FREE(value);
+		TALLOC_FREE(valstr);
 	}
 
 	ret = pfunc("registry shares", "yes");
@@ -3239,7 +3255,14 @@
 	pstrcpy(fname, pszParmValue);
 
 	if (strequal(fname, INCLUDE_REGISTRY_NAME)) {
-		return process_registry_globals(do_parameter);
+		if (bInGlobalSection) {
+			return process_registry_globals(do_parameter);
+		}
+		else {
+			DEBUG(1, ("\"include = registry\" only effective "
+				  "in %s section\n", GLOBAL_NAME));
+			return False;
+		}
 	}
 
 	standard_sub_basic(get_current_username(), current_user_info.domain,



More information about the samba-cvs mailing list