summaryrefslogtreecommitdiff
path: root/commit.c
diff options
context:
space:
mode:
authorSebastian Götte <jaseg@physik.tu-berlin.de>2013-03-31 16:01:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-01 02:16:15 (GMT)
commitf8aae8d0efccd268babd482f10709b4f86a9f32e (patch)
treee46ec28fae350ae43e84d56d70772bc77fa7f68b /commit.c
parentffb6d7d5c99e4097e512def20b0133b7ee900953 (diff)
downloadgit-f8aae8d0efccd268babd482f10709b4f86a9f32e.zip
git-f8aae8d0efccd268babd482f10709b4f86a9f32e.tar.gz
git-f8aae8d0efccd268babd482f10709b4f86a9f32e.tar.bz2
commit.c/GPG signature verification: Also look at the first GPG status line
Signed-off-by: Sebastian Götte <jaseg@physik-pool.tu-berlin.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/commit.c b/commit.c
index 66a3f4e..94029c9 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');