diff options
author | Jan Pazdziora <jpazdziora@redhat.com> | 2022-01-30 14:24:16 +0100 |
---|---|---|
committer | Jan Pazdziora <jpazdziora@redhat.com> | 2022-01-30 14:27:54 +0100 |
commit | 6b8e9f444e02e2face1e606149cddce843ef2fa0 (patch) | |
tree | 29ddee1fc63f9e75f8ba1bd4b536c580ab813ccc /tests | |
parent | a01498b6b920cd7576535bd1974732c839408bc6 (diff) | |
download | mod_intercept_form_submit-6b8e9f444e02e2face1e606149cddce843ef2fa0.tar.gz mod_intercept_form_submit-6b8e9f444e02e2face1e606149cddce843ef2fa0.tar.xz mod_intercept_form_submit-6b8e9f444e02e2face1e606149cddce843ef2fa0.zip |
Not all systems support badname.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/config.sh | 9 | ||||
-rwxr-xr-x | tests/run.sh | 14 |
2 files changed, 17 insertions, 6 deletions
diff --git a/tests/config.sh b/tests/config.sh index 3f304c8..2db6364 100755 --- a/tests/config.sh +++ b/tests/config.sh @@ -10,7 +10,12 @@ chmod a+x /var/log/httpd cp tests/auth.conf /etc/httpd/conf.d/ useradd user1 echo user1:heslo1 | chpasswd -useradd --badname liška -echo 'liška:myši & zajíci' | chpasswd + +NAME='liška' +if ! useradd --badname "$NAME" 2> /dev/null ; then + NAME=liska + useradd "$NAME" +fi +echo "$NAME:myši & zajíci" | chpasswd chgrp apache /etc/shadow chmod g+r /etc/shadow diff --git a/tests/run.sh b/tests/run.sh index 5d394fc..a78351a 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -16,8 +16,14 @@ curl -u userx:heslox -s http://localhost/auth1 | tee /dev/stderr | grep -F 'REMO 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=heslo1' -si http://localhost/auth1 | tee /dev/stderr | grep -F -e 'REMOTE_USER=[user1]' -e 'login=user1&password=heslo1' | wc -l | grep -q 2 -curl --data 'login=li%C5%A1ka&password=myši+& zaj%c3%adci' -si http://localhost/auth1 | tee /dev/stderr | grep -F 'REMOTE_USER=[]' -curl --data 'login=li%C5%A1ka&password=myši %26%20zaj%c3%adci' -si http://localhost/auth1 | tee /dev/stderr | grep -F -e 'REMOTE_USER=[liška]' -e 'login=li%C5%A1ka&password=myši %26%20zaj%c3%adci' | wc -l | grep -q 2 +NAME='liška' +XNAME='li%c5%a1ka' +if ! getent passwd "$NAME" ; then + NAME=liska + XNAME=$NAME +fi +curl --data "login=$XNAME&password=myši+& zaj%c3%adci" -si http://localhost/auth1 | tee /dev/stderr | grep -F 'REMOTE_USER=[]' +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 '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 @@ -27,7 +33,7 @@ curl --data 'something=somewhere&password=heslo1&something=else&login=user1' -si chage -d $(date -d -2days +%Y-%m-%d) -M 1 user1 curl --data 'login=user1&password=heslo1' -si http://localhost/auth1s | tee /dev/stderr | grep -F -e 'HTTP/1.1 307 Temporary Redirect' -e 'Location: http://localhost/login?backurl=http%3a%2f%2flocalhost%2fauth1s&uid=user1' | wc -l | grep -q 2 curl --data 'something=somewhere&password=heslo1&something=else&login=user1' -si http://localhost/auth1s | tee /dev/stderr | grep -F -e 'HTTP/1.1 307 Temporary Redirect' -e 'Location: http://localhost/login?backurl=http%3a%2f%2flocalhost%2fauth1s&uid=user1' | wc -l | grep -q 2 -chage -d $(date -d -2days +%Y-%m-%d) -M 1 'liška' -curl --data 'something=somewhere&password=myši+%26%20zaj%C3%adci&something=else&login=liška' -si http://localhost/auth1s | tee /dev/stderr | grep -F -e 'HTTP/1.1 307 Temporary Redirect' -e 'Location: http://localhost/login?backurl=http%3a%2f%2flocalhost%2fauth1s&uid=li%c5%a1ka' | wc -l | grep -q 2 +chage -d $(date -d -2days +%Y-%m-%d) -M 1 "$NAME" +curl --data "something=somewhere&password=myši+%26%20zaj%C3%adci&something=else&login=$NAME" -si http://localhost/auth1s | tee /dev/stderr | grep -F -e 'HTTP/1.1 307 Temporary Redirect' -e "Location: http://localhost/login?backurl=http%3a%2f%2flocalhost%2fauth1s&uid=$XNAME" | wc -l | grep -q 2 echo OK $0. |