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>
Sebastian Götte committed
Mar 31, 2013 at 18:01 UTC
f8aae8d0efccd268babd482f10709b4f86a9f32e
1 file changed
+12
-5
commit.c
+12
-5
@@ -1054,13 +1054,20 @@ static void parse_gpg_output(struct signature_check *sigc)
1054
const char *buf = sigc->gpg_status;
1055
int i;
1056
1057
+ /* Iterate over all search strings */
1058
for (i = 0; i < ARRAY_SIZE(sigcheck_gpg_status); i++) {
1058
- const char *found = strstr(buf, sigcheck_gpg_status[i].check);
1059
- const char *next;
1060
- if (!found)
1061
- continue;
1059
+ const char *found, *next;
1060
+
1061
+ if (!prefixcmp(buf, sigcheck_gpg_status[i].check + 1)) {
1062
+ /* At the very beginning of the buffer */
1063
+ found = buf + strlen(sigcheck_gpg_status[i].check + 1);
1064
+ } else {
1065
+ found = strstr(buf, sigcheck_gpg_status[i].check);
1066
+ if (!found)
1067
+ continue;
1068
+ found += strlen(sigcheck_gpg_status[i].check);
1069
+ }
1070
sigc->result = sigcheck_gpg_status[i].result;
1063
- found += strlen(sigcheck_gpg_status[i].check);
1071
sigc->key = xmemdupz(found, 16);
1072
found += 17;
1073
next = strchrnul(found, '\n');