diff options
author | Michael Adam <obnox@samba.org> | 2007-08-17 16:03:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:29:54 -0500 |
commit | c56874d1129c6e5759acc5b125b5e8edd44a997c (patch) | |
tree | bb186109e0148c8986ad6f325013627c9601e0b6 /source3/utils | |
parent | bb76f3f98ed2e49ad4114a34a2a7fa0e6655f33d (diff) | |
download | samba-c56874d1129c6e5759acc5b125b5e8edd44a997c.tar.gz samba-c56874d1129c6e5759acc5b125b5e8edd44a997c.tar.bz2 samba-c56874d1129c6e5759acc5b125b5e8edd44a997c.zip |
r24527: Add a function lp_canonicalize_parameter_with_value that turns
a parameter and value into the canonical paramter with the value
inverted if it was in invers boolean synonym.
Make net conf use this function when storing parameters.
Michael
(This used to be commit 3b762ab18392fd06427957b0263262e3b8e34b9d)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_conf.c | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 2f0b3d6b04..c18b733a89 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -154,43 +154,20 @@ static WERROR reg_setvalue_internal(struct registry_key *key, char *subkeyname; const char *canon_valname; const char *canon_valstr; - BOOL canon_inverse; - struct parm_struct *parm; - - if (!lp_parameter_is_valid(valname)) { - d_fprintf(stderr, "Invalid parameter '%s' given.\n", valname); - werr = WERR_INVALID_PARAM; - goto done; - } - if (!lp_canonicalize_parameter(valname, &canon_valname, &canon_inverse)) + if (!lp_canonicalize_parameter_with_value(valname, valstr, + &canon_valname, + &canon_valstr)) { - d_fprintf(stderr, "ERROR: could not canonicalize parameter " - "'%s' after successful validation: this should not " - "happen!\n", valname); - werr = WERR_INVALID_PARAM; - goto done; - } - if (canon_inverse) { - if (!lp_invert_boolean(valstr, &canon_valstr)) { - d_fprintf(stderr, "invalid value '%s' given for " - "parameter '%s'\n", valstr, canon_valname); - werr = WERR_INVALID_PARAM; - goto done; - } - } else { - parm = lp_get_parameter(canon_valname); - if (parm->type == P_BOOL) { - if (!lp_canonicalize_boolean(valstr, &canon_valstr)) { - d_fprintf(stderr, "invalied value '%s' given " - "for parameter '%s'\n", valstr, - canon_valname); - werr = WERR_INVALID_PARAM; - goto done; - } + if (canon_valname == NULL) { + d_fprintf(stderr, "invalid parameter '%s' given\n", + valname); } else { - canon_valstr = valstr; + d_fprintf(stderr, "invalid value '%s' given for " + "parameter '%s'\n", valstr, valname); } + werr = WERR_INVALID_PARAM; + goto done; } ZERO_STRUCT(val); |