svn commit: samba r23760 - in branches: SAMBA_3_0/source/utils
SAMBA_3_0_26/source/utils
obnox at samba.org
obnox at samba.org
Mon Jul 9 09:35:05 GMT 2007
Author: obnox
Date: 2007-07-09 09:35:03 +0000 (Mon, 09 Jul 2007)
New Revision: 23760
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23760
Log:
Untangle use of strrchr_m and strequal and add some checks
for the validity of the given registry key name.
Michael
Modified:
branches/SAMBA_3_0/source/utils/net_conf.c
branches/SAMBA_3_0_26/source/utils/net_conf.c
Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_conf.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_conf.c 2007-07-09 08:45:14 UTC (rev 23759)
+++ branches/SAMBA_3_0/source/utils/net_conf.c 2007-07-09 09:35:03 UTC (rev 23760)
@@ -151,6 +151,7 @@
{
struct registry_value val;
WERROR werr = WERR_OK;
+ char *subkeyname;
ZERO_STRUCT(val);
@@ -171,12 +172,20 @@
goto done;
}
- if (!strequal(strrchr_m(key->key->name, '\\')+1, GLOBAL_NAME) &&
+ subkeyname = strrchr_m(key->key->name, '\\');
+ if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
+ d_fprintf(stderr, "Invalid registry key '%s' given as "
+ "smbconf section.\n", key->key->name);
+ werr = WERR_INVALID_PARAM;
+ goto done;
+ }
+ subkeyname++;
+ if (!strequal(subkeyname, GLOBAL_NAME) &&
lp_parameter_is_global(valname))
{
d_fprintf(stderr, "Global paramter '%s' not allowed in "
"service definition ('%s').\n", valname,
- strrchr_m(key->key->name, '\\')+1);
+ subkeyname);
werr = WERR_INVALID_PARAM;
goto done;
}
Modified: branches/SAMBA_3_0_26/source/utils/net_conf.c
===================================================================
--- branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-07-09 08:45:14 UTC (rev 23759)
+++ branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-07-09 09:35:03 UTC (rev 23760)
@@ -151,6 +151,7 @@
{
struct registry_value val;
WERROR werr = WERR_OK;
+ char *subkeyname;
ZERO_STRUCT(val);
@@ -171,12 +172,20 @@
goto done;
}
- if (!strequal(strrchr_m(key->key->name, '\\')+1, GLOBAL_NAME) &&
+ subkeyname = strrchr_m(key->key->name, '\\');
+ if ((subkeyname == NULL) || (*(subkeyname +1) == '\0')) {
+ d_fprintf(stderr, "Invalid registry key '%s' given as "
+ "smbconf section.\n", key->key->name);
+ werr = WERR_INVALID_PARAM;
+ goto done;
+ }
+ subkeyname++;
+ if (!strequal(subkeyname, GLOBAL_NAME) &&
lp_parameter_is_global(valname))
{
d_fprintf(stderr, "Global paramter '%s' not allowed in "
"service definition ('%s').\n", valname,
- strrchr_m(key->key->name, '\\')+1);
+ subkeyname);
werr = WERR_INVALID_PARAM;
goto done;
}
More information about the samba-cvs
mailing list