From: list at eworm.de (Christian Hesse)
Subject: [PATCH v3 1/1] snapshot: support tar signature for compressed tar
Date: Thu, 7 Jun 2018 21:38:44 +0200 [thread overview]
Message-ID: <20180607193844.18784-1-list@eworm.de> (raw)
In-Reply-To: <20180607213645.4c5938ff@leda>
From: Christian Hesse <mail at eworm.de>
This adds support for kernel.org style signatures where the uncompressed
tar archive is signed and compressed later. The signature is valid for
all tar* snapshots.
We have a filter which snapshots may be generated and downloaded. This has
to allow tar signatures now even if tar itself is not allowed. To simplify
things we allow all signatures.
Signed-off-by: Christian Hesse <mail at eworm.de>
---
ui-shared.c | 12 +++++++++++-
ui-snapshot.c | 2 +-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ui-shared.c b/ui-shared.c
index 8a786e0..51a25a0 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -1114,7 +1114,7 @@ void cgit_compose_snapshot_prefix(struct strbuf *filename, const char *base,
void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
const char *separator)
{
- const struct cgit_snapshot_format* f;
+ const struct cgit_snapshot_format *f, *f_tar;
struct strbuf filename = STRBUF_INIT;
const char *basename;
size_t prefixlen;
@@ -1125,6 +1125,9 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
else
cgit_compose_snapshot_prefix(&filename, basename, ref);
+ for (f_tar = cgit_snapshot_formats; strcmp(f_tar->suffix, ".tar") != 0; f_tar++)
+ /* nothing */ ;
+
prefixlen = filename.len;
for (f = cgit_snapshot_formats; f->suffix; f++) {
if (!(repo->snapshots & f->bit))
@@ -1139,6 +1142,13 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
cgit_snapshot_link("sig", NULL, NULL, NULL, NULL,
filename.buf);
html(")");
+ } else if (starts_with(f->suffix, ".tar") && cgit_snapshot_get_sig(ref, f_tar)) {
+ strbuf_setlen(&filename, strlen(filename.buf) - strlen(f->suffix));
+ strbuf_addstr(&filename, ".tar.asc");
+ html(" (");
+ cgit_snapshot_link("sig", NULL, NULL, NULL, NULL,
+ filename.buf);
+ html(")");
}
html(separator);
}
diff --git a/ui-snapshot.c b/ui-snapshot.c
index c7611e8..76d0573 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -263,7 +263,7 @@ void cgit_print_snapshot(const char *head, const char *hex,
}
f = get_format(filename);
- if (!f || !(ctx.repo->snapshots & f->bit)) {
+ if (!f || (!sig_filename && !(ctx.repo->snapshots & f->bit))) {
cgit_print_error_page(400, "Bad request",
"Unsupported snapshot format: %s", filename);
return;
next prev parent reply other threads:[~2018-06-07 19:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 12:12 Custom snapshot prefix & Snapshot signatures list
2018-06-07 12:15 ` [PATCH 1/1] snapshot: support tar signature for compressed tar list
2018-06-07 13:17 ` john
2018-06-07 15:13 ` list
2018-06-07 15:14 ` [PATCH v2 1/2] ui-snapshot: use named constants for snapshot formats list
2018-06-07 15:14 ` [PATCH v2 2/2] snapshot: support tar signature for compressed tar list
2018-06-07 15:21 ` john
2018-06-07 19:36 ` list
2018-06-07 19:38 ` list [this message]
2018-06-27 16:34 ` [PATCH v3 1/1] " Jason
2018-06-27 20:14 ` john
2018-07-02 7:10 ` list
2018-07-03 18:56 ` Jason
2018-06-08 22:11 ` [PATCH 1/1] snapshot: strip bit from struct cgit_snapshot_format list
2018-06-09 11:16 ` john
2018-06-11 6:51 ` list
2018-06-11 6:53 ` [PATCH v2 " list
2018-06-07 13:10 ` Custom snapshot prefix & Snapshot signatures john
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=20180607193844.18784-1-list@eworm.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).