From 20a97a54ec35c08476c3c21a5f2de79fa5d9fec6 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Fri, 3 Jan 2003 18:07:36 +0000 Subject: [PATCH] Detect in-line key material when checking for traditional PGP messages. --- pgp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/pgp.c b/pgp.c index 24a9b706..729ad69e 100644 --- a/pgp.c +++ b/pgp.c @@ -419,6 +419,7 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b, int tagged_only) short sgn = 0; short enc = 0; + short key = 0; if (b->type != TYPETEXT) return 0; @@ -447,18 +448,25 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b, int tagged_only) enc = 1; else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) sgn = 1; + else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0) + key = 1; } } safe_fclose (&tfp); unlink (tempfile); - if (!enc && !sgn) + if (!enc && !sgn && !key) return 0; /* fix the content type */ mutt_set_parameter ("format", "fixed", &b->parameter); - mutt_set_parameter ("x-action", enc ? "pgp-encrypted" : "pgp-signed", &b->parameter); + if (enc) + mutt_set_parameter ("x-action", "pgp-encrypted", &b->parameter); + else if (sgn) + mutt_set_parameter ("x-action", "pgp-signed", &b->parameter); + else if (key) + mutt_set_parameter ("x-action", "pgp-keys", &b->parameter); return 1; } @@ -532,6 +540,8 @@ int mutt_is_application_pgp (BODY *m) t |= PGPSIGN; else if (p && !ascii_strncasecmp ("pgp-encrypt", p, 11)) t |= PGPENCRYPT; + else if (p && !ascii_strncasecmp ("pgp-keys", p, 7)) + t |= PGPKEY; } return t; } -- 2.40.0