[gmime] Updated GMimeParser to set GMIME_OPENPGP_DATA_NONE when appropriate



commit 03514263cf36b977668b11bda65aca84e218a98e
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Thu Dec 14 12:32:12 2017 -0500

    Updated GMimeParser to set GMIME_OPENPGP_DATA_NONE when appropriate

 gmime/gmime-parser.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gmime/gmime-parser.c b/gmime/gmime-parser.c
index 7dbb0c1..e4a079b 100644
--- a/gmime/gmime-parser.c
+++ b/gmime/gmime-parser.c
@@ -1611,6 +1611,16 @@ parser_scan_mime_part_content (GMimeParser *parser, GMimePart *mime_part, Bounda
                g_mime_part_set_openpgp_data (mime_part, GMIME_OPENPGP_DATA_PRIVATE_KEY);
                break;
        default:
+               if (mime_part->encoding != GMIME_CONTENT_ENCODING_BASE64 &&
+                   mime_part->encoding != GMIME_CONTENT_ENCODING_UUENCODE) {
+                       /* If the Content-Transfer-Encoding is not obfuscated by base64 or uuencode,
+                          then we can safely assume that no OpenPGP blocks exist. */
+                       g_mime_part_set_openpgp_data (mime_part, GMIME_OPENPGP_DATA_NONE);
+               } else if (!g_mime_content_type_is_type (mime_part->content_type, "text", "*")) {
+                       /* The content is base64 or uuencoded, but it's not text so it should be safe
+                          to assume that there won't be any OpenPGP blocks in the decoded content. */
+                       g_mime_part_set_openpgp_data (mime_part, GMIME_OPENPGP_DATA_NONE);
+               }
                break;
        }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]