summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-06-29 13:07:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:42 -0500
commitbf92d567984f00ebb998fb2485d0aac87d30b924 (patch)
tree8f36e27a294fae5d3924a255e58f122fa598b652
parent639051e58d4da9fb1116c19f0790250640b6ac7a (diff)
downloadsamba-bf92d567984f00ebb998fb2485d0aac87d30b924.tar.gz
samba-bf92d567984f00ebb998fb2485d0aac87d30b924.tar.xz
samba-bf92d567984f00ebb998fb2485d0aac87d30b924.zip
r23657: Prevent setting of a global option in a share definition
in "net conf setparm". Michael
-rw-r--r--source/param/loadparm.c18
-rw-r--r--source/utils/net_conf.c11
2 files changed, 28 insertions, 1 deletions
diff --git a/source/param/loadparm.c b/source/param/loadparm.c
index 58ea751fa58..8c6c0f1afec 100644
--- a/source/param/loadparm.c
+++ b/source/param/loadparm.c
@@ -2789,6 +2789,24 @@ BOOL lp_parameter_valid(const char *pszParmName)
}
/***************************************************************************
+ Check whether the given name is the name of a global parameter.
+ Returns True for strings belonging to parameters of class
+ P_GLOBAL, False for all other strings, also for parametric options
+ and strings not belonging to any option.
+***************************************************************************/
+
+BOOL lp_parameter_is_global(const char *pszParmName)
+{
+ int num = map_parameter(pszParmName);
+
+ if (num >= 0) {
+ return (parm_table[num].p_class == P_GLOBAL);
+ }
+
+ return False;
+}
+
+/***************************************************************************
Map a parameter's string representation to something we can use.
Returns False if the parameter string is not recognised, else TRUE.
***************************************************************************/
diff --git a/source/utils/net_conf.c b/source/utils/net_conf.c
index 5af2d6ccc53..1c61a25ee9c 100644
--- a/source/utils/net_conf.c
+++ b/source/utils/net_conf.c
@@ -178,12 +178,21 @@ static WERROR reg_setvalue_internal(struct registry_key *key,
}
if (registry_smbconf_valname_forbidden(valname)) {
- d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n",
+ d_fprintf(stderr, "Parameter '%s' not allowed in registry.\n",
valname);
werr = WERR_INVALID_PARAM;
goto done;
}
+ if (!strequal(key->key->name, GLOBAL_NAME) &&
+ lp_parameter_is_global(valname))
+ {
+ d_fprintf(stderr, "Global paramter '%s' not allowed in "
+ "service definition.\n", valname);
+ werr = WERR_INVALID_PARAM;
+ goto done;
+ }
+
werr = reg_setvalue(key, valname, &val);
if (!W_ERROR_IS_OK(werr)) {
d_fprintf(stderr,