summaryrefslogtreecommitdiff
path: root/t/t9400-git-cvsserver-server.sh
diff options
context:
space:
mode:
authorFrank Lichtenheld <frank@lichtenheld.de>2007-06-07 16:57:00 +0200
committerJunio C Hamano <gitster@pobox.com>2007-06-08 02:37:18 -0700
commit4890888d742e12044b1f4b89a5d10437a6371253 (patch)
tree5ce676c9858b831e5e52fa4a22be9613e6f525ed /t/t9400-git-cvsserver-server.sh
parent225696af2ceaa2e06345954003eda742a76c4e0a (diff)
downloadgit-4890888d742e12044b1f4b89a5d10437a6371253.tar.gz
cvsserver: Make req_Root more critical of its input data
The path submitted with the Root request has to be absolute (cvs does it this way and it may save us some sanity checks later) If multiple roots are specified (e.g. because we use pserver authentication which will already include the root), ensure that they say all the same. Probably neither is a security risk, and neither should ever be triggered by a sane client, but when validating input data, it's better to be save than sorry. Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9400-git-cvsserver-server.sh')
-rwxr-xr-xt/t9400-git-cvsserver-server.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh
index e9ef315173..41dcf646d1 100755
--- a/t/t9400-git-cvsserver-server.sh
+++ b/t/t9400-git-cvsserver-server.sh
@@ -110,6 +110,40 @@ test_expect_success 'pserver authentication failure (login/non-anonymous user)'
tail -n1 log | grep -q "^I HATE YOU$"'
+# misuse pserver authentication for testing of req_Root
+
+cat >request-relative <<EOF
+BEGIN AUTH REQUEST
+gitcvs.git
+anonymous
+
+END AUTH REQUEST
+EOF
+
+cat >request-conflict <<EOF
+BEGIN AUTH REQUEST
+$SERVERDIR
+anonymous
+
+END AUTH REQUEST
+Root $WORKDIR
+EOF
+
+test_expect_success 'req_Root failure (relative pathname)' \
+ 'if cat request-relative | git-cvsserver pserver >log 2>&1
+ then
+ echo unexpected success
+ false
+ else
+ true
+ fi &&
+ tail log | grep -q "^error 1 Root must be an absolute pathname$"'
+
+test_expect_success 'req_Root failure (conflicting roots)' \
+ 'cat request-conflict | git-cvsserver pserver >log 2>&1 &&
+ tail log | grep -q "^error 1 Conflicting roots specified$"'
+
+
#--------------
# CONFIG TESTS
#--------------