diff options
author | Michael Adam <obnox@samba.org> | 2013-09-22 03:39:48 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-09-24 07:44:28 +0200 |
commit | 4a65969e11d3bc7da62afec82de9f6d51d5e6a08 (patch) | |
tree | b5175b3dae8c8d92e046a232af90953c098397b6 /source3/lib/smbconf | |
parent | 5426e57898b2b60b7def1af24050df10b1394c9e (diff) | |
download | samba-4a65969e11d3bc7da62afec82de9f6d51d5e6a08.tar.gz |
libsmbconf:registry: rework smbconf_reg_parameter_forbidden(), renaming it.
The logic is inverted, the lp_parameter_is_invalid call of
smbconf_reg_valname_valid() is included, and the function
is renamed to smbconf_reg_parameter_is_valid().
Use the new function everywhere in smbconf registry backend.
And remove corresponding reverse function smbconf_reg_valname_valid().
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source3/lib/smbconf')
-rw-r--r-- | source3/lib/smbconf/smbconf_reg.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c index ec6b93fd09d..6848a731ca1 100644 --- a/source3/lib/smbconf/smbconf_reg.c +++ b/source3/lib/smbconf/smbconf_reg.c @@ -50,13 +50,14 @@ static struct reg_private_data *rpd(struct smbconf_ctx *ctx) return (struct reg_private_data *)(ctx->data); } -/* - * check whether a given value name is forbidden in registry (smbconf) +/** + * Check whether a given parameter name is valid in the + * smbconf registry backend. */ -static bool smbconf_reg_valname_forbidden(const char *valname) +static bool smbconf_reg_parameter_is_valid(const char *param_name) { /* hard code the list of forbidden names here for now */ - const char *forbidden_valnames[] = { + const char *forbidden_names[] = { "lock directory", "lock dir", "config backend", @@ -66,18 +67,17 @@ static bool smbconf_reg_valname_forbidden(const char *valname) }; const char **forbidden = NULL; - for (forbidden = forbidden_valnames; *forbidden != NULL; forbidden++) { - if (strwicmp(valname, *forbidden) == 0) { - return true; + if (!lp_parameter_is_valid(param_name)) { + return false; + } + + for (forbidden = forbidden_names; *forbidden != NULL; forbidden++) { + if (strwicmp(param_name, *forbidden) == 0) { + return false; } } - return false; -} -static bool smbconf_reg_valname_valid(const char *valname) -{ - return (!smbconf_reg_valname_forbidden(valname) && - lp_parameter_is_valid(valname)); + return true; } /** @@ -189,7 +189,7 @@ static sbcErr smbconf_reg_set_value(struct registry_key *key, goto done; } - if (smbconf_reg_valname_forbidden(canon_valname)) { + if (!smbconf_reg_parameter_is_valid(canon_valname)) { DEBUG(5, ("Parameter '%s' not allowed in registry.\n", canon_valname)); err = SBC_ERR_INVALID_PARAM; @@ -456,7 +456,7 @@ static sbcErr smbconf_reg_get_values(TALLOC_CTX *mem_ctx, { char *valstring; - if (!smbconf_reg_valname_valid(valname)) { + if (!smbconf_reg_parameter_is_valid(valname)) { continue; } @@ -1008,7 +1008,7 @@ static sbcErr smbconf_reg_get_parameter(struct smbconf_ctx *ctx, goto done; } - if (!smbconf_reg_valname_valid(param)) { + if (!smbconf_reg_parameter_is_valid(param)) { err = SBC_ERR_INVALID_PARAM; goto done; } @@ -1053,7 +1053,7 @@ static sbcErr smbconf_reg_delete_parameter(struct smbconf_ctx *ctx, goto done; } - if (!smbconf_reg_valname_valid(param)) { + if (!smbconf_reg_parameter_is_valid(param)) { err = SBC_ERR_INVALID_PARAM; goto done; } |