From: Brendan Cully Date: Thu, 5 Jul 2007 00:22:24 +0000 (-0700) Subject: GPGME: Stop parsing message as soon as PGP header is found. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6079a8baf4f6f53dbea433e96ab1053adb095bdb;p=neomutt GPGME: Stop parsing message as soon as PGP header is found. Use file_to_data_object to build data for inline signature verification instead of doing it by hand. This fixes inline verification for me. TODO: crypt-gpgme helper functions seem to return lots of pointers off the stack in very dubious ways. --- diff --git a/ChangeLog b/ChangeLog index 3edf62749..a71b7e453 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-27 10:38 -0700 Dan Fandrich (3354ac2e79c7) + + * pager.c: Fix %P in pager status for off_t variability. + +2007-06-27 10:35 -0700 Dan Fandrich (095360e1b819) + + * dotlock.c: remove a double inclusion of config.h + 2007-06-14 18:17 -0700 Sertaç (55cd4cb611d9) * rfc3676.c: flowed: consider a single space as a hard line break. @@ -5,7 +13,7 @@ 2007-06-13 10:43 -0700 Vsevolod Volkov (8d02c65ed0b5) - * ChangeLog, po/ru.po: Updated Russian translation + * po/ru.po: Updated Russian translation 2007-06-11 09:27 -0700 René Clerc (5eaa1cfe80ad) diff --git a/crypt-gpgme.c b/crypt-gpgme.c index 59bc5b03d..9bf771ea8 100644 --- a/crypt-gpgme.c +++ b/crypt-gpgme.c @@ -1858,9 +1858,15 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b, int tagged_only) if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15)) { if (!mutt_strcmp ("MESSAGE-----\n", buf + 15)) + { enc = 1; + break; + } else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15)) + { sgn = 1; + break; + } } } safe_fclose (&tfp); @@ -2039,25 +2045,7 @@ int pgp_gpgme_application_handler (BODY *m, STATE *s) || (clearsign && (s->flags & M_VERIFY))); /* Copy PGP material to an data container */ - armored_data = create_gpgme_data (); - gpgme_data_write (armored_data, buf, strlen (buf)); - while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) - { - offset = ftello (s->fpin); - bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf)*/ - last_pos = offset; - - gpgme_data_write (armored_data, buf, strlen (buf)); - - if ((needpass - && !mutt_strcmp ("-----END PGP MESSAGE-----\n", buf)) - || (!needpass - && (!mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) - || !mutt_strcmp ( - "-----END PGP PUBLIC KEY BLOCK-----\n",buf)))) - break; - } - + armored_data = file_to_data_object (s->fpin, m->offset, m->length); /* Invoke PGP if needed */ if (!clearsign || (s->flags & M_VERIFY)) {