List for cgit developers and users
 help / color / mirror / Atom feed
From: cgit at ml.breakpoint.cc (cgit at ml.breakpoint.cc)
Subject: [PATCH 1/3] snapshots: Don't allow sneaked in snapshots requests
Date: Thu, 21 Jun 2012 09:09:46 +0200	[thread overview]
Message-ID: <1340262588-24202-1-git-send-email-cgit@ml.breakpoint.cc> (raw)

From: Sebastian Andrzej Siewior <sebastian at 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 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ui-snapshot.c b/ui-snapshot.c
index 07cc944..5034c19 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -168,6 +168,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.7.2.5





             reply	other threads:[~2012-06-21  7:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-21  7:09 cgit [this message]
2012-06-21  7:09 ` [PATCH 2/3] cache: use sendfile() instead of a pair of read() + write() cgit
2012-06-23 10:27   ` mathstuf
2012-06-23 19:25     ` [PATCH 2/3 v2] " cgit
2012-06-21  7:09 ` [PATCH 3/3] summary: Add tag head line in the dowload section 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=1340262588-24202-1-git-send-email-cgit@ml.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).