summaryrefslogtreecommitdiff
path: root/validate
Commit message (Collapse)AuthorAgeFilesLines
* ubox: Replace { 0 } with {}.Rosen Penev2017-11-061-1/+1
| | | | | | The latter is more compatible with older GCC versions like 4.9. Additionally, initializing with { 0 } produces a warning that only the first field was initialized. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ubox: Initialize conditionally uninitialized variabledRosen Penev2016-12-191-8/+15
| | | | | | fixes false positive warning from "-Wconditional-uninitialized in clang" Signed-off by: Rosen Penev <rosenp@gmail.com>
* ubox: Fix some memory leaksRosen Penev2016-12-191-1/+3
| | | | | | Avoids leaking memory when exiting early. Signed-off by: Rosen <rosenp@gmail.com>
* validate: fix datatype handling of default valuesJo-Philipp Wich2016-07-261-35/+28
| | | | | | | | Properly handle the datatype of default values when the corresponding uci value is unset. Also consolidate the three default value code branches into a single one. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* validate: return error on failed validationLuka Perkov2014-06-291-12/+17
| | | | | | | | | In the procd script (/lib/functions/procd.sh) uci_validate_section is in charge of validating the uci config files. The uci_validate_section function checks return code of validate_data tool; without this change in case of invalid config values the function is not able to catch errors. Signed-off-by: Luka Perkov <luka@openwrt.org>
* validate: add missing yes/no boolean valuesLuka Perkov2014-06-281-2/+2
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* validate: add valid bool types enabled/disabledLuka Perkov2014-06-281-2/+2
| | | | | | | They are already supported in config_get_bool function found in OpenWrt base-package. Signed-off-by: Luka Perkov <luka@openwrt.org>
* validate: fix indentationLuka Perkov2014-06-281-44/+44
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* validate: range and base arguments for numeric types, new types hexstring, ↵Jo-Philipp Wich2014-02-231-33/+238
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | regexp and uci - make uinteger and integer types more strict, they will not accept leading spaces or plus signs anymore - add optional base argument to uinteger and integer data types, e.g. integer(16) will accept -af or 0xaf, a base of 0 (the default) will use the underlying heuristics of strtol() / strtoul() - add optional min and max options to string() datatype, e.g. string(3) only accepts strings longer than 3 chars, string(8, 63) will accept strings between 8 and 63 characters in length - add hexstring([minlen [, maxlen]]) type which will accept long hex encoded strings whose length must be a multiple of 2 - add regexp(pattern) type which applies an extended POSIX regular expression on the value to test. The given pattern is implicitely anchored, e.g. regexp("[a-z]+") will match /^[a-z]+$/ - add uci(package, {@type|name}[, option]) type which tests the input against selected uci values, e.g. * uci("network", "@interface") would allow values that match the name of any section of type "interface" in /e/c/network * uci("network", "@interface", "ifname") would allow any value that matches one of the ifnames in any section of type interface in /e/c/network * uci("system", "ntp", "server") would allow any value that matches on of the servers in the "server" option of the "ntp" section in /e/c/system Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* validate: properly deal with datatype expressions containing escaped colonsJo-Philipp Wich2013-11-301-19/+41
|
* validate: fix length calculation of string literals and store value type for ↵Jo-Philipp Wich2013-11-301-2/+6
| | | | literal comparisations
* validate: fix return type of dt_parse() callJo-Philipp Wich2013-11-301-1/+1
|
* validate: support uci lists in cli client and use dt_parse() return value to ↵Jo-Philipp Wich2013-11-281-41/+130
| | | | decide whether an option should be handled as bool
* validate: change dt_parse() to return an enum indicating the kind of value ↵Jo-Philipp Wich2013-11-282-49/+59
| | | | that was matched (bool, number, string)
* add a c version of the current uci_valisate call to the cliJohn Crispin2013-11-221-4/+115
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* add validation codeJohn Crispin2013-11-153-0/+1049
Signed-off-by: John Crispin <blogic@openwrt.org>