svn commit: samba r23667 - in branches: SAMBA_3_0/source/registry SAMBA_3_0_26/source/registry

obnox at samba.org obnox at samba.org
Sat Jun 30 22:31:14 GMT 2007


Author: obnox
Date: 2007-06-30 22:31:13 +0000 (Sat, 30 Jun 2007)
New Revision: 23667

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23667

Log:
Prevent storing of forbidden parameter names in registry
configuration as values. I would really like to check whether
the valuename is a valid parameter name (with lp_parameter_is_valid)
here, but unfortunately, regedit cereates new values as
"New Value #1" (and so on) first, before dropping into the
rename box. So this is impossible here.

Michael


Modified:
   branches/SAMBA_3_0/source/registry/reg_smbconf.c
   branches/SAMBA_3_0_26/source/registry/reg_smbconf.c


Changeset:
Modified: branches/SAMBA_3_0/source/registry/reg_smbconf.c
===================================================================
--- branches/SAMBA_3_0/source/registry/reg_smbconf.c	2007-06-30 21:35:39 UTC (rev 23666)
+++ branches/SAMBA_3_0/source/registry/reg_smbconf.c	2007-06-30 22:31:13 UTC (rev 23667)
@@ -42,6 +42,19 @@
 
 static BOOL smbconf_store_values( const char *key, REGVAL_CTR *val )
 {
+	int i;
+	int num_values = regval_ctr_numvals(val);
+
+	for (i=0; i < num_values; i++) {
+		REGISTRY_VALUE *theval = regval_ctr_specific_value(val, i);
+		const char *valname = regval_name(theval);
+
+		if (registry_smbconf_valname_forbidden(valname)) {
+			DEBUG(0, ("smbconf_store_values: value '%s' forbidden "
+			      "in registry.\n", valname));
+			return False;
+		}
+	}
 	return regdb_ops.store_values(key, val);
 }
 

Modified: branches/SAMBA_3_0_26/source/registry/reg_smbconf.c
===================================================================
--- branches/SAMBA_3_0_26/source/registry/reg_smbconf.c	2007-06-30 21:35:39 UTC (rev 23666)
+++ branches/SAMBA_3_0_26/source/registry/reg_smbconf.c	2007-06-30 22:31:13 UTC (rev 23667)
@@ -42,6 +42,19 @@
 
 static BOOL smbconf_store_values( const char *key, REGVAL_CTR *val )
 {
+	int i;
+	int num_values = regval_ctr_numvals(val);
+
+	for (i=0; i < num_values; i++) {
+		REGISTRY_VALUE *theval = regval_ctr_specific_value(val, i);
+		const char *valname = regval_name(theval);
+
+		if (registry_smbconf_valname_forbidden(valname)) {
+			DEBUG(0, ("smbconf_store_values: value '%s' forbidden "
+			      "in registry.\n", valname));
+			return False;
+		}
+	}
 	return regdb_ops.store_values(key, val);
 }
 



More information about the samba-cvs mailing list