r23667: Prevent storing of forbidden parameter names in registry
authorMichael Adam <obnox@samba.org>
Sat, 30 Jun 2007 22:31:13 +0000 (22:31 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:44 +0000 (12:23 -0500)
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

source/registry/reg_smbconf.c

index b17422fdcb3101a28fe5f7c7ebedbab599bbce0a..3427645fa693dcbe98e3d8f36ce1c2a24ba2275b 100644 (file)
@@ -42,6 +42,19 @@ static int smbconf_fetch_values( const char *key, REGVAL_CTR *val )
 
 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);
 }