Thread (14 messages) flat view 14 messages, 4 authors, 2016-06-15
DORMANTno replies

[PATCH] tag,verify-tag: do not trip over rfc1991 signatures

From: Michael J Gruber <hidden>
Date: 2016-06-15 22:49:42
Subsystem: the rest · Maintainer: Linus Torvalds

Currently, git expects "-----BEGIN PGP SIGNATURE-----" at the beginning of a
signature. But gpg uses "MESSAGE" instead of "SIGNATURE" when used with
the "rfc1991" option. This leads to git's faling to verify it's own
signed tags.

Be more lenient and take "-----BEGIN PGP " as the indicator.

Reported-by: Stephan Hugel <redacted>
Signed-off-by: Michael J Gruber <redacted>
---
 builtin/tag.c        |    6 +++---
 builtin/verify-tag.c |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index d311491..04bec17 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -29,7 +29,7 @@ struct tag_filter {
 	struct commit_list *with_commit;
 };
 
-#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
+#define PGP_SIGNATURE "-----BEGIN PGP "
 
 static int show_reference(const char *refname, const unsigned char *sha1,
 			  int flag, void *cb_data)
@@ -72,7 +72,7 @@ static int show_reference(const char *refname, const unsigned char *sha1,
 		/* only take up to "lines" lines, and strip the signature */
 		for (i = 0, sp += 2;
 				i < filter->lines && sp < buf + size &&
-				prefixcmp(sp, PGP_SIGNATURE "\n");
+				prefixcmp(sp, PGP_SIGNATURE);
 				i++) {
 			if (i)
 				printf("\n    ");
@@ -256,7 +256,7 @@ static void write_tag_body(int fd, const unsigned char *sha1)
 		return;
 	}
 	sp += 2; /* skip the 2 LFs */
-	eob = strstr(sp, "\n" PGP_SIGNATURE "\n");
+	eob = strstr(sp, "\n" PGP_SIGNATURE);
 	if (eob)
 		len = eob - sp;
 	else
diff --git a/builtin/verify-tag.c b/builtin/verify-tag.c
index 9f482c2..3c85d0a 100644
--- a/builtin/verify-tag.c
+++ b/builtin/verify-tag.c
@@ -17,7 +17,7 @@ static const char * const verify_tag_usage[] = {
 		NULL
 };
 
-#define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
+#define PGP_SIGNATURE "-----BEGIN PGP "
 
 static int run_gpg_verify(const char *buf, unsigned long size, int verbose)
 {
-- 
1.7.3.98.g5ad7d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help