diff --git a/includes/dbdetect.class.sh b/includes/dbdetect.class.sh index 03a67e920c81c8a201fca731ae952de89498d2f8..a7327f1744af651c4c5f0ee1ff95d64618c12352 100644 --- a/includes/dbdetect.class.sh +++ b/includes/dbdetect.class.sh @@ -80,7 +80,7 @@ function dbdetect.validate(){ local _config="${1:-$DBD_INIFILE}" # show errors in profile ini files - ini.validate "$_config" "$( dirname "$0")/includes/dbdetect_validate_profile_ini.sh" 0 && dbdetect._wd "OK: Validation of '$_config' successful" + ini.validate "$_config" "$( dirname "$0")/includes/dbdetect_validate_profile.ini" 1 && dbdetect._wd "OK: Validation of '$_config' was successful" } # check if the requirements for a database match diff --git a/includes/dbdetect_validate_profile.ini b/includes/dbdetect_validate_profile.ini new file mode 100644 index 0000000000000000000000000000000000000000..b438680e36adbe096969bca1e6f0528525dc67d8 --- /dev/null +++ b/includes/dbdetect_validate_profile.ini @@ -0,0 +1,52 @@ +# ---------------------------------------------------------------------- +# +# VALIDATE PROFILE INI +# +# ---------------------------------------------------------------------- + +# IDEA +[style] +section = "^[a-zA-Z0-9_]*$" +key = "^[a-zA-Z0-9_\-]*$" + +# ---------------------------------------------------------------------- +# section names +# +# SYNTAX: +# comma separated list of sections +# ---------------------------------------------------------------------- + +[sections] +must = "detect,set" +can = "" + +# ---------------------------------------------------------------------- +# validate keys in sections +# +# SYNTAX: +# <section> .<key> = "<VALIDATION_TYPE>[:<VALIDATION_VALUE>]" +# VALIDATION_TYPE: +# - INTEGER +# - REGEX:<REGEX_TO_VALIDATE> +# - ONEOF:<VALUE1[,<VALUE_N>]> +# ---------------------------------------------------------------------- + +[varsMust] +; detect.tcp-port = "INTEGER" + +[varsCan] +detect.binary = "REGEX:.*" +detect.process = +detect.tcp-port = "INTEGER" +detect.tcp-target = "REGEX:.*" +detect.tcp-process = +detect.type = "ONEOF:sqlite" +detect.file[] = + +set.su = +set.dbuser = +set.dbpassword = +set.env = +set.params = + +# ----------------------------------------------------------------------