From: Michael Adam Date: Sat, 30 Jun 2007 22:31:13 +0000 (+0000) Subject: r23667: Prevent storing of forbidden parameter names in registry X-Git-Tag: samba-4.0.0alpha6~801^2~5497 X-Git-Url: http://git.samba.org/samba.git/?p=ira%2Fwip.git;a=commitdiff_plain;h=ba2dc0530fa6fc7353655812be24444478e12ba1 r23667: 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 (This used to be commit 10014833da868289ae28db2e7c1edfd353ca7b2b) --- diff --git a/source3/registry/reg_smbconf.c b/source3/registry/reg_smbconf.c index b17422fdcb3..3427645fa69 100644 --- a/source3/registry/reg_smbconf.c +++ b/source3/registry/reg_smbconf.c @@ -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); }