]> git.ipfire.org Git - thirdparty/strongswan.git/blobdiff - testing/ssh
android: Use activity when reconnecting without (or a possibly wrong) password
[thirdparty/strongswan.git] / testing / ssh
index 9e6d49a61062df3cec35f6c08c084a523bdb62f6..95d064c157985d10776e726ecc2bd7327f87e8e2 100755 (executable)
@@ -2,6 +2,7 @@
 
 DIR=$(dirname `readlink -f $0`)
 . $DIR/testing.conf
+SSHCONF="-F $DIR/ssh_config"
 
 if [ $# == 0 ]
 then
@@ -10,11 +11,26 @@ then
 fi
 
 host=$1
-ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, '{ print $1 }' | awk '{ print $1 }'`"
-if [ -z $ip ]
+echo "$host" | grep -q "^\([0-9]\+\.\|[0-9a-fA-F]\+:\).*"
+if [ $? -eq 0 ]
 then
-       echo "Host '$host' unknown"
-       exit 1
+       # assume we got an ip address
+       ip=$host
+else
+       pos='$1'
+       echo "$host" | grep -q ".*1$"
+       if [ $? -eq 0 ]
+       then
+               # {host}1, use second address
+               pos='$2'
+               host=`echo "$host" | sed -n -e "s/1$//p"`
+       fi
+       ip="`echo $HOSTNAMEIPV4 | sed -n -e "s/^.*${host},//gp" | awk -F, "{ print ${pos} }" | awk '{ print $1 }'`"
+       if [ -z $ip ]
+       then
+               echo "Host '$host' unknown"
+               exit 1
+       fi
 fi
 
 shift