]> git.ipfire.org Git - people/ms/network.git/commitdiff
aiccu: Add check to verify that only supported protocols are given by the CLI.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 16 Apr 2013 16:23:59 +0000 (18:23 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Mon, 22 Apr 2013 15:27:28 +0000 (17:27 +0200)
functions.aiccu
hooks/zones/aiccu

index a201ee19ca0d7009bb21f2fb8da33b99b012c32a..d29c538bbfa3e6603790d83a7b79fe6f36782ef4 100644 (file)
@@ -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}
index a40a17b8140a054e2bbb2c8fcfe93c97571afbff..c5fbdd0f5c9e74e93262670d8cc1aea8986744f0 100755 (executable)
@@ -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() {