summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2007-07-09 09:35:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:53 -0500
commitd4f1b08c935cc5c2c7509c50334d3b3f6cc3b371 (patch)
tree3adbda6102b6dc43b814517f520717e5fa2eaf19 /source3
parent014a596f426721fcf15014a735051d951b186208 (diff)
downloadsamba-d4f1b08c935cc5c2c7509c50334d3b3f6cc3b371.tar.gz
samba-d4f1b08c935cc5c2c7509c50334d3b3f6cc3b371.tar.bz2
samba-d4f1b08c935cc5c2c7509c50334d3b3f6cc3b371.zip
r23760: Untangle use of strrchr_m and strequal and add some checks
for the validity of the given registry key name. Michael (This used to be commit 4b4ba7724ee77a93e32cd7f3c5884d965fe9bcaa)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_conf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c
index 4990541384..61bcb60aaf 100644
--- a/source3/utils/net_conf.c
+++ b/source3/utils/net_conf.c
@@ -151,6 +151,7 @@ static WERROR reg_setvalue_internal(struct registry_key *key,
{
struct registry_value val;
WERROR werr = WERR_OK;
+ char *subkeyname;
ZERO_STRUCT(val);
@@ -171,12 +172,20 @@ static WERROR reg_setvalue_internal(struct registry_key *key,
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;
}