mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
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)
This commit is contained in:
parent
014a596f42
commit
d4f1b08c93
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user