From: Stefan Schantl Date: Tue, 16 Apr 2013 16:23:59 +0000 (+0200) Subject: aiccu: Add check to verify that only supported protocols are given by the CLI. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5c92542a000f656627b9ecbb992624e3ca4264b;p=people%2Fstevee%2Fnetwork.git aiccu: Add check to verify that only supported protocols are given by the CLI. --- diff --git a/functions.aiccu b/functions.aiccu index a201ee19..d29c538b 100644 --- a/functions.aiccu +++ b/functions.aiccu @@ -19,6 +19,9 @@ # # ############################################################################### +# Define protocols which are supported by aiccu. +AICCU_SUPPORTED_PROTOCOLS="tic tsp l2tp" + function aiccu_start() { local device=${1} assert isset device @@ -95,7 +98,7 @@ function aiccu_write_config() { assert isset server assert isset protocol assert isset require_tls - assert isoneof protocol tic tsp l2tp + assert isoneof ${protocol} ${AICCU_SUPPORTED_PROTOCOLS} # Write configuration file header. config_header "aiccu configuration file for ${zone}" > ${file} diff --git a/hooks/zones/aiccu b/hooks/zones/aiccu index a40a17b8..c5fbdd0f 100755 --- a/hooks/zones/aiccu +++ b/hooks/zones/aiccu @@ -36,6 +36,13 @@ function _check() { assert isset SERVER assert isset PROTOCOL assert isset REQUIRE_TLS + + # Check if a supported protocol has been given. + if ! list_match "${PROTOCOL}" ${AICCU_SUPPORTED_PROTOCOLS}; then + log ERROR "This protocol is not supported by aiccu: ${PROTOCOL}" + log ERROR "Valid protocols are: ${AICCU_SUPPORTED_PROTOCOLS}" + return ${EXIT_ERROR} + fi } function _parse_cmdline() {