From f8aae8d0efccd268babd482f10709b4f86a9f32e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20G=C3=B6tte?= Date: Sun, 31 Mar 2013 18:01:34 +0200 Subject: [PATCH] commit.c/GPG signature verification: Also look at the first GPG status line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sebastian Götte Signed-off-by: Junio C Hamano --- commit.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/commit.c b/commit.c index 66a3f4e8f4..94029c9496 100644 --- a/commit.c +++ b/commit.c @@ -1054,13 +1054,20 @@ static void parse_gpg_output(struct signature_check *sigc) const char *buf = sigc->gpg_status; int i; + /* Iterate over all search strings */ for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) { - const char *found = strstr(buf, sigcheck_gpg_status[i].check); - const char *next; - if (!found) - continue; + const char *found, *next; + + if (!prefixcmp(buf, sigcheck_gpg_status[i].check + 1)) { + /* At the very beginning of the buffer */ + found = buf + strlen(sigcheck_gpg_status[i].check + 1); + } else { + found = strstr(buf, sigcheck_gpg_status[i].check); + if (!found) + continue; + found += strlen(sigcheck_gpg_status[i].check); + } sigc->result = sigcheck_gpg_status[i].result; - found += strlen(sigcheck_gpg_status[i].check); sigc->key = xmemdupz(found, 16); found += 17; next = strchrnul(found, '\n');