From: sebastian at breakpoint.cc (Sebastian Andrzej Siewior)
Subject: [PATCH 1/4] snapshots: Don't allow sneaked in snapshots requests
Date: Sat, 18 Jan 2014 21:24:57 +0100 [thread overview]
Message-ID: <1390076700-16626-2-git-send-email-sebastian@breakpoint.cc> (raw)
In-Reply-To: <1390076700-16626-1-git-send-email-sebastian@breakpoint.cc>
If the snapshots are not enabled then the frontend won't show a link to it.
The skilled user however may construct the URL on his own and the frontend
will obey the request.
This patch adds a check for this case so the requst won't be served.
Signed-off-by: Sebastian Andrzej Siewior <sebastian at breakpoint.cc>
---
ui-snapshot.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 582dc31..b278ddf 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -209,6 +209,12 @@ void cgit_print_snapshot(const char *head, const char *hex,
return;
}
+ if (!(f->bit & snapshots)) {
+ show_error(xstrdup(fmt("Snapshot format %s is not enabled.",
+ f->suffix)));
+ return;
+ }
+
if (!hex && dwim) {
hex = get_ref_from_filename(ctx.repo->url, filename, f);
if (hex == NULL) {
--
1.8.5.2
next prev parent reply other threads:[~2014-01-18 20:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-18 20:24 my out-of-tree patches for cgit sebastian
2014-01-18 20:24 ` sebastian [this message]
2014-02-01 14:54 ` [PATCH 1/4] snapshots: Don't allow sneaked in snapshots requests sebastian
2014-02-02 14:49 ` cgit
2014-01-18 20:24 ` [PATCH 2/4] cache: use sendfile() instead of a pair of read() + write() sebastian
2014-01-18 21:32 ` jamie.couture
2014-01-19 14:12 ` Jason
2014-01-19 14:13 ` Jason
2014-01-19 15:17 ` Jason
2014-01-18 20:24 ` [PATCH 3/4] summary: Add tag head line in the dowload section sebastian
2014-01-19 14:17 ` Jason
2014-02-02 14:43 ` cgit
2014-01-18 20:25 ` [PATCH 4/4] repolist: add a git link on front page sebastian
2014-01-19 14:19 ` Jason
2014-02-01 14:53 ` sebastian
[not found] <1351455531-12208-1-git-send-email-sebastian@breakpoint.cc>
2012-10-28 20:40 ` [PATCH 1/4] snapshots: Don't allow sneaked in snapshots requests Jason
2012-10-29 0:33 ` nobody
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=1390076700-16626-2-git-send-email-sebastian@breakpoint.cc \
--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).