svn commit: samba r23657 - in branches: SAMBA_3_0/source/param
SAMBA_3_0/source/utils SAMBA_3_0_26/source/param
SAMBA_3_0_26/source/utils
obnox at samba.org
obnox at samba.org
Fri Jun 29 13:07:56 GMT 2007
Author: obnox
Date: 2007-06-29 13:07:54 +0000 (Fri, 29 Jun 2007)
New Revision: 23657
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23657
Log:
Prevent setting of a global option in a share definition
in "net conf setparm".
Michael
Modified:
branches/SAMBA_3_0/source/param/loadparm.c
branches/SAMBA_3_0/source/utils/net_conf.c
branches/SAMBA_3_0_26/source/param/loadparm.c
branches/SAMBA_3_0_26/source/utils/net_conf.c
Changeset:
Modified: branches/SAMBA_3_0/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0/source/param/loadparm.c 2007-06-29 12:30:41 UTC (rev 23656)
+++ branches/SAMBA_3_0/source/param/loadparm.c 2007-06-29 13:07:54 UTC (rev 23657)
@@ -2789,6 +2789,24 @@
}
/***************************************************************************
+ 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.
***************************************************************************/
Modified: branches/SAMBA_3_0/source/utils/net_conf.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_conf.c 2007-06-29 12:30:41 UTC (rev 23656)
+++ branches/SAMBA_3_0/source/utils/net_conf.c 2007-06-29 13:07:54 UTC (rev 23657)
@@ -178,12 +178,21 @@
}
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,
Modified: branches/SAMBA_3_0_26/source/param/loadparm.c
===================================================================
--- branches/SAMBA_3_0_26/source/param/loadparm.c 2007-06-29 12:30:41 UTC (rev 23656)
+++ branches/SAMBA_3_0_26/source/param/loadparm.c 2007-06-29 13:07:54 UTC (rev 23657)
@@ -2790,6 +2790,24 @@
}
/***************************************************************************
+ 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.
***************************************************************************/
Modified: branches/SAMBA_3_0_26/source/utils/net_conf.c
===================================================================
--- branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-06-29 12:30:41 UTC (rev 23656)
+++ branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-06-29 13:07:54 UTC (rev 23657)
@@ -178,12 +178,21 @@
}
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,
More information about the samba-cvs
mailing list