tests: check whether max-same-clients is considered in per-user-config

This commit is contained in:
Nikos Mavrogiannopoulos
2015-11-06 12:40:13 +01:00
parent bc0131301e
commit 532b751d9d
2 changed files with 23 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ PORT=4512
echo "Testing ocserv and user route application... "
TMPFILE1=${srcdir}/test-user-config.tmp
TMPFILE2=${srcdir}/test-user-config-2.tmp
rm -f ${TMPFILE1}
@@ -49,11 +50,29 @@ echo ok
sleep 2
echo -n "Re-connecting to check the iroutes"
echo -n "Re-connecting to check the iroutes... "
$OPENCONNECT -v localhost:$PORT --sslkey ${srcdir}/user-key.pem -c ${srcdir}/user-cert-testuser.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s /bin/true </dev/null >${TMPFILE1} 2>&1 &
kpid2=$!
sleep 4
echo ok
sleep 3
echo -n "Checking if max-same-clients is considered... "
timeout 15s $OPENCONNECT localhost:$PORT --sslkey ${srcdir}/user-key.pem -c ${srcdir}/user-cert-testuser.pem --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 -s /bin/true </dev/null >${TMPFILE2} 2>&1
if test $? = 124;then
fail $PID "Max-same-clients directive was ignored"
fi
CONTENTS=`cat ${TMPFILE2}|grep "HTTP/1.1 401 Unauthorized"`
if test -z "$CONTENTS";then
cat ${TMPFILE2}
fail $PID "Max-same-clients directive was ignored"
fi
echo ok
sleep 2
kill $kpid1
kill $kpid2
@@ -89,6 +108,7 @@ fi
echo ok
rm -f ${TMPFILE1}
rm -f ${TMPFILE2}
kill $PID
wait

View File

@@ -1,3 +1,4 @@
dpd = 880
mobile-dpd = 880
keepalive = 14400
max-same-clients = 1