mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 08:46:58 +08:00
tests: use /bin/echo to provide '-e' and elimination of some bashisms
This commit is contained in:
@@ -6,6 +6,7 @@ fi
|
||||
|
||||
. ./common.sh
|
||||
|
||||
ECHO_E="/bin/echo -e"
|
||||
if test -x /usr/bin/lockfile-create;then
|
||||
LOCKFILE="lockfile-create docker"
|
||||
UNLOCKFILE="lockfile-remove docker"
|
||||
@@ -73,7 +74,7 @@ retrieve_user_info() {
|
||||
grep "$MATCH" out$TMP
|
||||
fi
|
||||
ret=$?
|
||||
if test $ret == 0;then
|
||||
if test $ret = 0;then
|
||||
break
|
||||
fi
|
||||
counter=`expr $counter + 1`
|
||||
|
||||
@@ -54,14 +54,14 @@ if test ! -z "$QUIT_ON_INIT";then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "testuser" >pass-full$TMP
|
||||
$ECHO_E "testuser" >pass-full$TMP
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
|
||||
if test $? = 0;then
|
||||
echo "Authentication with wrong password succeeded!"
|
||||
stop
|
||||
fi
|
||||
|
||||
echo -e "test" >pass-full$TMP
|
||||
$ECHO_E "test" >pass-full$TMP
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-full$TMP
|
||||
if test $? = 0;then
|
||||
echo "Authentication with wrong username succeeded!"
|
||||
@@ -70,14 +70,14 @@ fi
|
||||
|
||||
echo ""
|
||||
echo "Connecting with correct username"
|
||||
echo -e "test" >pass-full$TMP
|
||||
$ECHO_E "test" >pass-full$TMP
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-full$TMP &
|
||||
PID=$!
|
||||
|
||||
rm -f pass-full$TMP
|
||||
|
||||
#wait for openconnect
|
||||
sleep 5
|
||||
rm -f pass-full$TMP
|
||||
|
||||
# The client IP depends on the username so it shouldn't change.
|
||||
ping -w 5 192.168.1.1
|
||||
|
||||
@@ -56,14 +56,14 @@ if test ! -z "$QUIT_ON_INIT";then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "testuser" >pass-radius$TMP
|
||||
$ECHO_E "testuser" >pass-radius$TMP
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
|
||||
if test $? = 0;then
|
||||
echo "Authentication with wrong password succeeded!"
|
||||
stop
|
||||
fi
|
||||
|
||||
echo -e "test" >pass-radius$TMP
|
||||
$ECHO_E "test" >pass-radius$TMP
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -u testuser --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly < pass-radius$TMP
|
||||
if test $? = 0;then
|
||||
echo "Authentication with wrong username succeeded!"
|
||||
@@ -71,7 +71,7 @@ if test $? = 0;then
|
||||
fi
|
||||
|
||||
echo "Trying with correct password"
|
||||
echo -e "test" >pass-radius$TMP
|
||||
$ECHO_E "test" >pass-radius$TMP
|
||||
$OPENCONNECT $IP:$PORT_OCSERV -u test --passwd-on-stdin -v --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass-radius$TMP &
|
||||
PID=$!
|
||||
|
||||
|
||||
@@ -53,14 +53,14 @@ if test ! -z "$QUIT_ON_INIT";then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo -e "test\ntest" >pass$TMP
|
||||
$ECHO_E "test\ntest" >pass$TMP
|
||||
$OPENCONNECT $IP:6551 -u test --passwd-on-stdin --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 < pass$TMP &
|
||||
PID=$!
|
||||
|
||||
rm -f pass$TMP
|
||||
|
||||
#wait for openconnect
|
||||
sleep 5
|
||||
rm -f pass$TMP
|
||||
|
||||
# The client IP depends on the username so it shouldn't change.
|
||||
ping -w 5 192.168.99.1
|
||||
|
||||
Reference in New Issue
Block a user