From 4e51e2a0ac0ecb665469a1777084d531a335c81e Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sat, 22 Sep 2018 20:59:22 +0200 Subject: [PATCH] tests: added check with empty password Relates #171 Signed-off-by: Nikos Mavrogiannopoulos --- tests/test-pam | 5 +++++ tests/test-pam-noauth | 4 ++++ tests/test-pass | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/tests/test-pam b/tests/test-pam index 421bbfb3..f88341ee 100755 --- a/tests/test-pam +++ b/tests/test-pam @@ -39,6 +39,11 @@ echo "Connecting with wrong password... " ( echo -e "testuser\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -v $ADDRESS:$PORT --authgroup group2 -u testuser --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && fail $PID "Received cookie with wrong cred" +echo "" +echo "Connecting with empty password... " +( echo -e "\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -v $ADDRESS:$PORT --authgroup group2 -u testuser --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && + fail $PID "Received cookie with wrong cred" + echo "" echo "Connecting with wrong username... " ( echo -e "testuser123\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -v $ADDRESS:$PORT --authgroup group2 -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && diff --git a/tests/test-pam-noauth b/tests/test-pam-noauth index 40f52d6c..570f1d6d 100755 --- a/tests/test-pam-noauth +++ b/tests/test-pam-noauth @@ -41,6 +41,10 @@ echo "Connecting with incorrect password (correct in PAM) and existing user... " ( echo -e "testuser123\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u testuser --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && fail $PID "Received cookie with non existing user" +echo "Connecting with empty password (correct in PAM) and existing user... " +( echo -e "\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u testuser --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && + fail $PID "Received cookie with non existing user" + echo "Connecting with correct password and existing user... " ( echo -e "test\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u testuser --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly ) ||#>/dev/null 2>&1 ) || fail $PID "Could not receive cookie from server" diff --git a/tests/test-pass b/tests/test-pass index ca0b037a..3130fba4 100755 --- a/tests/test-pass +++ b/tests/test-pass @@ -40,6 +40,10 @@ echo "Connecting to obtain cookie with wrong password... " ( echo "tost" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && fail $PID "Received cookie when we shouldn't" +echo "Connecting to obtain cookie with empty password... " +( echo -e "\n" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u test --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && + fail $PID "Received cookie when we shouldn't" + echo "Connecting to obtain cookie with wrong username... " ( echo "tost" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:$PORT -u tost --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly >/dev/null 2>&1 ) && fail $PID "Received cookie when we shouldn't"