From 8ca561beab777f8b76d350ffa3a7821551981487 Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Sun, 30 Jan 2022 15:36:46 +0100 Subject: Add test of EXTERNAL_AUTH_ERROR. --- tests/auth.cgi | 1 + tests/pam-webl | 2 +- tests/run.sh | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/auth.cgi b/tests/auth.cgi index 6a17487..5932b34 100755 --- a/tests/auth.cgi +++ b/tests/auth.cgi @@ -4,6 +4,7 @@ echo "Content-Type: text/plain" echo "Pragma: no-cache" echo echo "REMOTE_USER=[$REMOTE_USER]" +[ -z "$EXTERNAL_AUTH_ERROR" ] || echo "EXTERNAL_AUTH_ERROR=[$EXTERNAL_AUTH_ERROR]" echo --- cat echo diff --git a/tests/pam-webl b/tests/pam-webl index 7ae90c8..5d92000 100644 --- a/tests/pam-webl +++ b/tests/pam-webl @@ -1,2 +1,2 @@ -auth sufficient pam_unix.so +auth required pam_unix.so account required pam_unix.so diff --git a/tests/run.sh b/tests/run.sh index 978ea62..738325e 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -14,7 +14,8 @@ done curl -s http://localhost/auth1 | tee /dev/stderr | grep -F 'REMOTE_USER=[]' curl -u userx:heslox -s http://localhost/auth1 | tee /dev/stderr | grep -F 'REMOTE_USER=[]' curl --data '' -si http://localhost/auth1 | tee /dev/stderr | grep -F 'REMOTE_USER=[]' -curl --data 'login=user1&password=heslox' -si http://localhost/auth1 | tee /dev/stderr | grep -F 'REMOTE_USER=[]' +curl --data 'login=user1&password=heslox' -si http://localhost/auth1 | tee /dev/stderr | grep -F -e 'REMOTE_USER=[]' -e 'EXTERNAL_AUTH_ERROR=[Authentication failure]' | wc -l | grep -q 2 +curl --data 'login=user2&password=heslox' -si http://localhost/auth1 | tee /dev/stderr | grep -F -e 'REMOTE_USER=[]' -e 'EXTERNAL_AUTH_ERROR=[User not known to the underlying authentication module]' | wc -l | grep -q 2 curl --data 'login=user1&password=heslo1' -si http://localhost/auth1 | tee /dev/stderr | grep -F -e 'REMOTE_USER=[user1]' -e 'login=user1&password=heslo1' | wc -l | grep -q 2 NAME='liška' XNAME='li%c5%a1ka' @@ -26,7 +27,7 @@ curl --data "login=$XNAME&password=myši+& zaj%c3%adci" -si http://localhost/aut curl --data "login=$XNAME&password=myši %26%20zaj%c3%adci" -si http://localhost/auth1 | tee /dev/stderr | grep -F -e "REMOTE_USER=[$NAME]" -e "login=$XNAME&password=myši %26%20zaj%c3%adci" | wc -l | grep -q 2 curl --data 'something=somewhere&password=heslo1&something=else&login=user1' -si http://localhost/auth1 | tee /dev/stderr | grep -F -e 'REMOTE_USER=[user1]' -e 'something=somewhere&password=heslo1&something=else&login=user1' | wc -l | grep -q 2 curl --data 'login=user1&password=heslo1' -si http://localhost/auth1r | tee /dev/stderr | grep -F -e 'REMOTE_USER=[user1]' -e 'login=user1&password=[REDACTED]' | wc -l | grep -q 2 -curl --data 'password=xheslo&login=user1&something=extra' -si http://localhost/auth1r | tee /dev/stderr | grep -F -e 'REMOTE_USER=[]' -e 'password=[REDACTED]&login=user1&something=extra' | wc -l | grep -q 2 +curl --data 'password=xheslo&login=user1&something=extra' -si http://localhost/auth1r | tee /dev/stderr | grep -F -e 'REMOTE_USER=[]' -e 'EXTERNAL_AUTH_ERROR=[Authentication failure]' -e 'password=[REDACTED]&login=user1&something=extra' | wc -l | grep -q 3 curl --data 'something=somewhere&password=heslo1&something=else&login=user1' -si http://localhost/auth1r | tee /dev/stderr | grep -F -e 'REMOTE_USER=[user1]' -e 'something=somewhere&password=[REDACTED]&something=else&login=user1' | wc -l | grep -q 2 curl --data 'login=user1&password=heslo1' -si http://localhost/auth1s | tee /dev/stderr | grep -F -e 'REMOTE_USER=[user1]' -e 'login=user1&password=[REDACTED]' | wc -l | grep -q 2 -- cgit