From: cgit at cryptocrack.de (Lukas Fleischer)
Subject: [PATCH] Disallow downloading disabled snapshot formats
Date: Fri, 10 Jan 2014 15:38:06 +0100 [thread overview]
Message-ID: <1389364686-14089-1-git-send-email-cgit@cryptocrack.de> (raw)
We did only display enabled snapshot formats but we did not prevent from
downloading disabled formats when requested. Fix this by adding an
appropriate check.
Also, add a test case that checks whether downloading disabled snapshot
formats is denied, as expected.
Signed-off-by: Lukas Fleischer <cgit at cryptocrack.de>
---
tests/t0107-snapshot.sh | 5 +++++
ui-snapshot.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/t0107-snapshot.sh b/tests/t0107-snapshot.sh
index 6cf7aaa..01e8d22 100755
--- a/tests/t0107-snapshot.sh
+++ b/tests/t0107-snapshot.sh
@@ -79,4 +79,9 @@ test_expect_success UNZIP 'verify unzipped file-5' '
test_line_count = 1 master/file-5
'
+test_expect_success 'try to download a disabled snapshot format' '
+ cgit_url "foo/snapshot/master.tar.xz" |
+ grep "Unsupported snapshot format"
+'
+
test_done
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 8f82119..ab20a4a 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -205,7 +205,7 @@ void cgit_print_snapshot(const char *head, const char *hex,
}
f = get_format(filename);
- if (!f) {
+ if (!f || (snapshots & f->bit) == 0) {
show_error("Unsupported snapshot format: %s", filename);
return;
}
--
1.8.5.2
next reply other threads:[~2014-01-10 14:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 14:38 cgit [this message]
2014-01-10 14:50 ` john
2014-01-10 15:02 ` cgit
2014-01-10 16:11 ` Jason
2014-01-10 17:14 ` cgit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1389364686-14089-1-git-send-email-cgit@cryptocrack.de \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).