summaryrefslogtreecommitdiff
path: root/tests/mod-auth.t
diff options
context:
space:
mode:
authorStefan Bühler <stbuehler@web.de>2013-04-29 13:08:25 +0000
committerStefan Bühler <stbuehler@web.de>2013-04-29 13:08:25 +0000
commitc26b50d9ad992ef73ada5a96e0db29781ddad88a (patch)
treeeda50a9d7b039c141663881cbe0d9fda000d8fd5 /tests/mod-auth.t
parent0342dfef1d43a0f40bb8cdf4c5acbe2adca33ded (diff)
downloadlighttpd1.4-c26b50d9ad992ef73ada5a96e0db29781ddad88a.tar.gz
lighttpd1.4-c26b50d9ad992ef73ada5a96e0db29781ddad88a.zip
[mod_auth] add htpasswd -s (SHA1) support if openssl is used (needs openssl for SHA1). This doesn't use any salt, md5 with salt is probably better.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2870 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'tests/mod-auth.t')
-rwxr-xr-xtests/mod-auth.t20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/mod-auth.t b/tests/mod-auth.t
index 89ead9dd..e070df10 100755
--- a/tests/mod-auth.t
+++ b/tests/mod-auth.t
@@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
-use Test::More tests => 15;
+use Test::More tests => 17;
use LightyTest;
my $tf = LightyTest->new();
@@ -65,6 +65,24 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (des) (lowercase)');
+$t->{REQUEST} = ( <<EOF
+GET /server-config HTTP/1.0
+Host: auth-htpasswd.example.org
+Authorization: Basic c2hhOnNoYQ==
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200 } ];
+ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (sha)');
+
+$t->{REQUEST} = ( <<EOF
+GET /server-config HTTP/1.0
+Host: auth-htpasswd.example.org
+Authorization: Basic c2hhOnNoYg==
+EOF
+ );
+$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 401 } ];
+ok($tf->handle_http($t) == 0, 'Basic-Auth: Valid Auth-token - htpasswd (sha, wrong password)');
+
SKIP: {
skip "no md5 for crypt under cygwin", 1 if $^O eq 'cygwin';