summaryrefslogtreecommitdiff
path: root/rtadm
diff options
context:
space:
mode:
Diffstat (limited to 'rtadm')
-rwxr-xr-xrtadm11
1 files changed, 7 insertions, 4 deletions
diff --git a/rtadm b/rtadm
index 148ad99..fce24d9 100755
--- a/rtadm
+++ b/rtadm
@@ -8,10 +8,12 @@ CFG_FILE=/etc/rapid-tunneling/rtadm
if [ -r $CFG_FILE ]; then . $CFG_FILE; fi
-if [ -z "$HOSTNAME" -o -z "$PORT" ]; then
- echo "ERROR: Hostname or port not set in configuration file $CFG_FILE." 1>&2
- exit 1
-fi
+verify_config_is_set() {
+ if [ -z "$HOSTNAME" -o -z "$PORT" ]; then
+ echo "ERROR: Hostname or port not set in configuration file $CFG_FILE." 1>&2
+ exit 1
+ fi
+}
create()
{
@@ -19,6 +21,7 @@ create()
TUNNEL_PORT=$1
COMMENT=$2
+ verify_config_is_set
if grep -q "ra-[0-9]\+-$COMMENT-[0-9]\+" $HOME/.ssh/authorized_keys 2>/dev/null; then
echo "Connection name '$COMMENT' already exists. Aborting." 1>&2