From 7ba41963dde175581ae7b395045fd51678237930 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 7 Jun 2018 21:31:28 +0200 Subject: snapshot: support tar signature for compressed tar 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 --- ui-shared.c | 9 ++++++++- ui-snapshot.c | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ui-shared.c b/ui-shared.c index 9a2e382..066a470 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; struct strbuf filename = STRBUF_INIT; const char *basename; size_t prefixlen; @@ -1139,6 +1139,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, &cgit_snapshot_formats[0])) { + 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 92c3277..fa3ceaf 100644 --- a/ui-snapshot.c +++ b/ui-snapshot.c @@ -86,6 +86,7 @@ static int write_tar_xz_archive(const char *hex, const char *prefix) } const struct cgit_snapshot_format cgit_snapshot_formats[] = { + /* .tar must remain the 0 index */ { ".tar", "application/x-tar", write_tar_archive }, { ".tar.gz", "application/x-gzip", write_tar_gzip_archive }, { ".tar.bz2", "application/x-bzip2", write_tar_bzip2_archive }, @@ -268,7 +269,7 @@ void cgit_print_snapshot(const char *head, const char *hex, } f = get_format(filename); - if (!f || !(ctx.repo->snapshots & cgit_snapshot_format_bit(f))) { + if (!f || (!sig_filename && !(ctx.repo->snapshots & cgit_snapshot_format_bit(f)))) { cgit_print_error_page(400, "Bad request", "Unsupported snapshot format: %s", filename); return; -- cgit 1.4.1 c/log/home/.hushlogin?id=48cf56609b1e3d98df6d89433630f601861c23c5&follow=1'>Collapse)Author 2018-02-09Move gfx interface to header fileJune McEnroe .o files should technically depend on this, but I don't think it will matter much. 2018-02-09Silence BSD ctags warningsJune McEnroe 2018-02-09Link LDLIBS regardless of GFXJune McEnroe 2018-02-09Move gfx frontends around to simplify buildJune McEnroe I forgot that you can expand variables inside variables names in make. Certainly makes some fun things possible. 2018-02-07Add janky X11 graphics frontendJune McEnroe 2018-02-07Include stdio.h in gfb.cJune McEnroe As promised. 2018-02-07Exit by returning false from input to gf{b,cocoa}June McEnroe I haven't built gfb yet, so a fix commit is probably incoming. 2018-02-07Rename title to status in gfcocoaJune McEnroe Also separate the options and fileName buffers in gfxx. 2018-02-06Require 4 bit counts on gfxx command lineJune McEnroe 2018-02-06Add gfxx controls for custom bitsJune McEnroe 2018-02-06Add gfxx palette loading and dumpingJune McEnroe 2018-02-06Add tags targetJune McEnroe This seems a bit out of character for me, but this is basically free: ctags(1) is part of FreeBSD and Darwin, and vim automatically uses tags. Also the format of tags files is cute. 2018-02-06Replace gfxx SCALE macro with interp functionJune McEnroe Short-circuits for b = 8. 2018-02-05Rename gfxx space indexed and add palette samplingJune McEnroe 2018-02-05Take scale into account for when to stop drawing in gfxxJune McEnroe 2018-02-05Always skip most significant bits in gfxxJune McEnroe This works for CARDS.DLL but might not for other things. We'll see. 2018-02-05Set title in gfcocoaJune McEnroe 2018-02-05Double-buffer gfb frontendJune McEnroe Still not vsync (seems like a newer DRM-fbdev implementation handles FBIO_WAITFORVSYNC but my kernel doesn't), but avoids flicker from clearing to black for each frame. 2018-02-05Rewrite gfxx bit handlingJune McEnroe Specifies how many bits for each of "alpha" (ignored), red, green, blue. Separates byte-order and bit-order. Much more flexible, but now won't render CARDS.DLL graphics properly due to the skip bit being not where it expects. Also mmaps the file instead of reading it all in. And the default palette and sampling got removed again for now, since it's too awkward to use. 2018-02-05Add flip option to gfxxJune McEnroe This handles upside-down graphics much better than reverse did. 2018-02-05Remove gfxx reverse optionJune McEnroe 2018-02-04Fix gfxx draw stop conditionJune McEnroe Would not draw the last partially visible column when mirrored. 2018-02-04Reuse CGColorSpace and CGDataProvider in gfcocoaJune McEnroe 2018-02-04Mark mac target phonyJune McEnroe 2018-02-04Set up Makefile for gfxx-cocoa or gfxx-fbJune McEnroe 2018-02-04Avoid doing excessive work in gfxxJune McEnroe By stopping when the next column would be off the edge of the buffer. 2018-02-04Handle window resizing in gfcocoaJune McEnroe 2018-02-04Set cinoptionsJune McEnroe 2018-02-04Tweak colorscheme moreJune McEnroe 2018-02-04Color MatchParen DarkYellowJune McEnroe White is not obvious enough. 2018-02-04Add palette sampling to gfxxJune McEnroe 2018-02-04Add 4-bit RGB to gfxxJune McEnroe Replace default palette with alternating black and white. 2018-02-04Add Quit menu item to gfcocoaJune McEnroe 2018-02-04Switch back to sane Objective-C styleJune McEnroe 2018-02-04Quit gfcocoa when window closesJune McEnroe 2018-02-03Apparently this is how people write Objective-CJune McEnroe