git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Thiago Farina <tfransosi@gmail.com>
Subject: [PATCHv2 5/5] tag: recognize rfc1991 signatures
Date: Wed, 10 Nov 2010 12:17:30 +0100	[thread overview]
Message-ID: <052734203b66fea86fda1b9aee0cf1975a3a6f9c.1289387142.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <cover.1289041051.git.git@drmicha.warpmail.net>
In-Reply-To: <cover.1289387142.git.git@drmicha.warpmail.net>

We have always been creating rfc1991 signatures for users with "rfc1991"
in their gpg config but failed to recognize them (tag -l -n largenumber)
and verify them (tag -v, verify-tag).

Make good use of the refactored signature detection and let us recognize
and verify those signatures also.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t7004-tag.sh |   12 ++++++------
 tag.c          |    4 +++-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index c7d49e1..6841c23 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1048,19 +1048,19 @@ cp "$1" actual
 EOF
 chmod +x fakeeditor
 
-test_expect_failure GPG \
+test_expect_success GPG \
 	'reediting a signed tag body omits signature' '
 	echo "RFC1991 signed tag" >expect &&
 	GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
 	test_cmp expect actual
 '
 
-test_expect_failure GPG \
+test_expect_success GPG \
 	'verifying rfc1991 signature' '
 	git tag -v rfc1991-signed-tag
 '
 
-test_expect_failure GPG \
+test_expect_success GPG \
 	'list tag with rfc1991 signature' '
 	echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
 	git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1073,12 +1073,12 @@ test_expect_failure GPG \
 
 rm -f gpghome/gpg.conf
 
-test_expect_failure GPG \
+test_expect_success GPG \
 	'verifying rfc1991 signature without --rfc1991' '
 	git tag -v rfc1991-signed-tag
 '
 
-test_expect_failure GPG \
+test_expect_success GPG \
 	'list tag with rfc1991 signature without --rfc1991' '
 	echo "rfc1991-signed-tag RFC1991 signed tag" >expect &&
 	git tag -l -n1 rfc1991-signed-tag >actual &&
@@ -1089,7 +1089,7 @@ test_expect_failure GPG \
 	test_cmp expect actual
 '
 
-test_expect_failure GPG \
+test_expect_success GPG \
 	'reediting a signed tag body omits signature' '
 	echo "RFC1991 signed tag" >expect &&
 	GIT_EDITOR=./fakeeditor git tag -f -s rfc1991-signed-tag $commit &&
diff --git a/tag.c b/tag.c
index d4f3080..f789744 100644
--- a/tag.c
+++ b/tag.c
@@ -5,6 +5,7 @@
 #include "blob.h"
 
 #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----"
+#define PGP_MESSAGE "-----BEGIN PGP MESSAGE-----"
 
 const char *tag_type = "tag";
 
@@ -140,7 +141,8 @@ size_t parse_signature(const char *buf, unsigned long size)
 {
 	char *eol;
 	size_t len = 0;
-	while (len < size && prefixcmp(buf + len, PGP_SIGNATURE)) {
+	while (len < size && prefixcmp(buf + len, PGP_SIGNATURE) &&
+			prefixcmp(buf + len, PGP_MESSAGE)) {
 		eol = memchr(buf + len, '\n', size - len);
 		len += eol ? eol - (buf + len) + 1 : size - len;
 	}
-- 
1.7.3.2.193.g78bbb

  parent reply	other threads:[~2010-11-10 11:19 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 22:13 Error when verifying tags signed using 1.7.3.1 Stephan Hugel
2010-10-04 22:51 ` Daniel Johnson
2010-10-04 23:04   ` Stephan Hugel
2010-10-04 23:59     ` Daniel Johnson
2010-10-05  0:17       ` Stephan Hugel
2010-10-05  8:00         ` Michael J Gruber
2010-10-05 13:28           ` Stephan Hugel
2010-10-05 15:07             ` Michael J Gruber
2010-10-05 15:19               ` Stephan Hugel
2010-10-05 15:39                 ` Michael J Gruber
2010-10-05 15:40                   ` [PATCH] tag,verify-tag: do not trip over rfc1991 signatures Michael J Gruber
2010-10-05 20:28                     ` Junio C Hamano
2010-10-05 20:42                       ` Michael J Gruber
2010-10-05 20:51                         ` Stephan Hugel
2010-10-05 20:56                           ` Michael J Gruber
2010-11-06 11:04                             ` [PATCH 0/5] Handling of " Michael J Gruber
2010-11-06 11:04                               ` [PATCH 1/5] t/t7004-tag: test handling " Michael J Gruber
2010-11-09 17:17                                 ` Junio C Hamano
2010-11-09 17:23                                   ` Michael J Gruber
2010-11-10  0:19                                     ` Junio C Hamano
2010-11-10  8:23                                       ` Michael J Gruber
2010-11-06 11:04                               ` [PATCH 2/5] verify-tag: factor out signature detection Michael J Gruber
2010-11-06 17:40                                 ` Thiago Farina
2010-11-06 11:04                               ` [PATCH 3/5] tag: factor out sig detection for body edits Michael J Gruber
2010-11-06 11:04                               ` [PATCH 4/5] tag: factor out sig detection for tag display Michael J Gruber
2010-11-06 11:04                               ` [PATCH 5/5] tag: recognize rfc1991 signatures Michael J Gruber
2010-11-06 17:46                                 ` Thiago Farina
2010-11-08 19:27                                   ` Junio C Hamano
2010-11-10 11:17                               ` [PATCHv2 0/5] Handling of " Michael J Gruber
2010-11-10 11:17                                 ` [PATCHv2 1/5] t/t7004-tag: test handling " Michael J Gruber
2010-11-10 11:17                                 ` [PATCHv2 2/5] verify-tag: factor out signature detection Michael J Gruber
2010-11-10 11:17                                 ` [PATCHv2 3/5] tag: factor out sig detection for body edits Michael J Gruber
2010-11-10 11:17                                 ` [PATCHv2 4/5] tag: factor out sig detection for tag display Michael J Gruber
2010-11-10 11:17                                 ` Michael J Gruber [this message]
2010-11-10 17:41                                 ` [PATCHv2 0/5] Handling of rfc1991 signatures Junio C Hamano
2010-10-05 20:42                     ` [PATCH] tag,verify-tag: do not trip over " Todd Zullinger
2010-10-05 20:47                       ` Michael J Gruber
2010-10-05 15:45                   ` Error when verifying tags signed using 1.7.3.1 Stephan Hugel
2010-10-05  9:41       ` Pat Thoyts

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=052734203b66fea86fda1b9aee0cf1975a3a6f9c.1289387142.git.git@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tfransosi@gmail.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).