aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2013-07-08 16:30:22 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2013-07-08 16:34:34 +0300
commit08a7915aaf08e9d2187fd3f26e0326673d4c8eb1 (patch)
tree7d9f02b59945ae7577e79c3cbfe5182b3a22e4b8 /tests
parent4e2b6995088963e287de5dcc507a5ab14a7134b1 (diff)
downloadvmod-basicauth-08a7915aaf08e9d2187fd3f26e0326673d4c8eb1.tar.gz
vmod-basicauth-08a7915aaf08e9d2187fd3f26e0326673d4c8eb1.tar.bz2
Implement SHA1 passwords.
* src/sha1.c: New file. * src/sha1.h: New file. * src/Makefile.am: Add new files. * src/vmod_basicauth.c (base64_decode): Fix bound checking. (sha1_match): New function. (match_tab): Add SHA1 method. * tests/test03.vtc: New test. * tests/Makefile.am: Add new file. * tests/htpasswd: Add SHA1 password. * README: Update. * src/vmod_basicauth.3: Update.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/htpasswd1
-rw-r--r--tests/test03.vtc23
3 files changed, 26 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4e4347b..4c32621 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,8 @@
VMOD_TESTS = \
test00.vtc\
test01.vtc\
- test02.vtc
+ test02.vtc\
+ test03.vtc
EXTRA_DIST=$(VMOD_TESTS) htpasswd
diff --git a/tests/htpasswd b/tests/htpasswd
index 5802542..918e141 100644
--- a/tests/htpasswd
+++ b/tests/htpasswd
@@ -1,3 +1,4 @@
method-md5:$apr1$VMppzIb7$PyrBTfSWt4hGZhOG2WIae1
method-crypt:.GSZ.lgnfLS1.
method-plain:guessme-plain
+method-sha1:{SHA}KDR7D7GzCqeoXNa4AQNURXHGo58=
diff --git a/tests/test03.vtc b/tests/test03.vtc
new file mode 100644
index 0000000..052b4ed
--- /dev/null
+++ b/tests/test03.vtc
@@ -0,0 +1,23 @@
+varnishtest "Test basic HTTP authentication: SHA1"
+
+server s1 {
+ rxreq
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+ import basicauth from "${vmod_topbuild}/src/.libs/libvmod_basicauth.so";
+ sub vcl_deliver {
+ set resp.http.result = basicauth.match("${vmod_topsrc}/tests/htpasswd", "Basic bWV0aG9kLXNoYTE6Z3Vlc3NtZS1zaGEx");
+ }
+} -start
+
+client c1 {
+ txreq -url "/"
+ rxresp
+ expect resp.http.result == true
+}
+
+client c1 -run
+
+

Return to:

Send suggestions and report system problems to the System administrator.