Smart-http tests: Improve coverage in test t5560
Commit 34b6cb8bb ("http-backend: Protect GIT_PROJECT_ROOT from /../ requests") added the path_info helper function to test t5560 but did not use it. We should use it as it provides another level of error checking. The /etc/.../passwd case is one that is not special (and the test fails for reasons other than being aliased), so we remove that test case. Also rename the function from 'path_info' to 'expect_aliased'. Acked-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tarmigan Casebolt committed
Jan 2, 2010 at 13:38 UTC
43015774c3a697abf8efee28e36238fc78cf45d1
1 file changed
+10
-11
t/t5560-http-backend.sh
+10
-11
@@ -162,15 +162,15 @@ test_expect_success 'http.receivepack false' '
162
run_backend() {
163
REQUEST_METHOD=GET \
164
GIT_PROJECT_ROOT="$HTTPD_DOCUMENT_ROOT_PATH" \
165
- PATH_INFO="$2" \
165
+ PATH_INFO="$1" \
166
git http-backend >act.out 2>act.err
167
}
168
169
-path_info() {
169
+expect_aliased() {
170
if test $1 = 0; then
171
run_backend "$2"
172
else
173
- test_must_fail run_backend "$2" &&
173
+ run_backend "$2" &&
174
echo "fatal: '$2': aliased" >exp.err &&
175
test_cmp exp.err act.err
176
fi
@@ -179,15 +179,14 @@ path_info() {
179
test_expect_success 'http-backend blocks bad PATH_INFO' '
180
config http.getanyfile true &&
181
182
- run_backend 0 /repo.git/HEAD &&
182
+ expect_aliased 0 /repo.git/HEAD &&
183
184
- run_backend 1 /repo.git/../HEAD &&
185
- run_backend 1 /../etc/passwd &&
186
- run_backend 1 ../etc/passwd &&
187
- run_backend 1 /etc//passwd &&
188
- run_backend 1 /etc/./passwd &&
189
- run_backend 1 /etc/.../passwd &&
190
- run_backend 1 //domain/data.txt
184
+ expect_aliased 1 /repo.git/../HEAD &&
185
+ expect_aliased 1 /../etc/passwd &&
186
+ expect_aliased 1 ../etc/passwd &&
187
+ expect_aliased 1 /etc//passwd &&
188
+ expect_aliased 1 /etc/./passwd &&
189
+ expect_aliased 1 //domain/data.txt
190
'
191
192
cat >exp <<EOF