svn commit: samba r23656 - 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 12:30:48 GMT 2007
Author: obnox
Date: 2007-06-29 12:30:41 +0000 (Fri, 29 Jun 2007)
New Revision: 23656
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23656
Log:
Add initial checking of the validity of a paramter
given to "net conf setparm". Add a utility function
lp_parameter_valid() for this to loadparm.c.
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:15:41 UTC (rev 23655)
+++ branches/SAMBA_3_0/source/param/loadparm.c 2007-06-29 12:30:41 UTC (rev 23656)
@@ -2776,7 +2776,19 @@
return (True);
}
+
/***************************************************************************
+ Check whether the given parameter name is valid.
+ Parametric options (names containing a colon) are considered valid.
+***************************************************************************/
+
+BOOL lp_parameter_valid(const char *pszParmName)
+{
+ return ((map_parameter(pszParmName) != -1) ||
+ (strchr(pszParmName, ':') != NULL));
+}
+
+/***************************************************************************
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:15:41 UTC (rev 23655)
+++ branches/SAMBA_3_0/source/utils/net_conf.c 2007-06-29 12:30:41 UTC (rev 23656)
@@ -167,9 +167,23 @@
else {
d_fprintf(stderr, "Only value types DWORD and SZ are"
"currently implemented for setting values.\n");
+ werr = WERR_INVALID_PARAM;
goto done;
}
+ if (!lp_parameter_valid(valname)) {
+ d_fprintf(stderr, "Invalid parameter '%s' given.\n", valname);
+ werr = WERR_INVALID_PARAM;
+ goto done;
+ }
+
+ if (registry_smbconf_valname_forbidden(valname)) {
+ d_fprintf(stderr, "Parameter '%s' not allowed in registry.\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:15:41 UTC (rev 23655)
+++ branches/SAMBA_3_0_26/source/param/loadparm.c 2007-06-29 12:30:41 UTC (rev 23656)
@@ -2777,7 +2777,19 @@
return (True);
}
+
/***************************************************************************
+ Check whether the given parameter name is valid.
+ Parametric options (names containing a colon) are considered valid.
+***************************************************************************/
+
+BOOL lp_parameter_valid(const char *pszParmName)
+{
+ return ((map_parameter(pszParmName) != -1) ||
+ (strchr(pszParmName, ':') != NULL));
+}
+
+/***************************************************************************
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:15:41 UTC (rev 23655)
+++ branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-06-29 12:30:41 UTC (rev 23656)
@@ -167,9 +167,23 @@
else {
d_fprintf(stderr, "Only value types DWORD and SZ are"
"currently implemented for setting values.\n");
+ werr = WERR_INVALID_PARAM;
goto done;
}
+ if (!lp_parameter_valid(valname)) {
+ d_fprintf(stderr, "Invalid parameter '%s' given.\n", valname);
+ werr = WERR_INVALID_PARAM;
+ goto done;
+ }
+
+ if (registry_smbconf_valname_forbidden(valname)) {
+ d_fprintf(stderr, "Parameter '%s' not allowed in registry.\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