[git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-64-g037b2aa
by Andre Heinecke
cvs at cvs.gnupg.org
Wed Sep 28 16:15:44 CEST 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG extension for MS Outlook".
The branch, nomapi has been updated
via 037b2aa3cba5d354586c1c7d311e86775ebb341e (commit)
via e482433121af2301ca34d5a9f45bae7378ae2464 (commit)
via e0cd79c6ef2afd91e3594cb1d8fc8e662f03c5b1 (commit)
from ef8ea4a537110d49503a4ceb2bb6d7214c7b2594 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 037b2aa3cba5d354586c1c7d311e86775ebb341e
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Wed Sep 28 16:14:50 2016 +0200
tests: Add test for a mail created by us
* tests/data/openpgp-encrypted-attachment-gpgol.mbox,
tests/data/openpgp-encrypted-attachment-gpgol.plain: New.
* tests/t-parser.cpp: Use it.
(main): Also check for zero attachment count.
diff --git a/tests/data/openpgp-encrypted-attachment-gpgol.mbox b/tests/data/openpgp-encrypted-attachment-gpgol.mbox
new file mode 100644
index 0000000..45296d4
--- /dev/null
+++ b/tests/data/openpgp-encrypted-attachment-gpgol.mbox
@@ -0,0 +1,42 @@
+-----BEGIN PGP MESSAGE-----
+
+hQEMAx7U8Lxs+8kSAQgAxhEhecDGfsuqNTejoxq2LgyIJV1Jwd5gOoPbbxDVDmsj
+Gi9RjoCl/M20Q1oy/Ir2r6b6KTvfBW1KpxDW23KGhyu7HYM3RGKct5fm3aQmUlbK
+eEwPn8h701qQLfCxzBDaEq2KUBnmPAFre4EoZn4m+sHlM3WKATCWKHfbkVMtkY5J
+IedPPwcTQtZwJgk23caf0vbx2UNKtdjOsaJ4sIXpWCW2PEJ8W+EQoWCH/DFmXX0n
+ohmKiTdsH//YNzR2ZBqvcBtcsdFxf2hTLFCaA6xBur4+HaQvpiI5xkLhQxWKN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
+-----END PGP MESSAGE-----
diff --git a/tests/data/openpgp-encrypted-attachment-gpgol.plain b/tests/data/openpgp-encrypted-attachment-gpgol.plain
new file mode 100644
index 0000000..77f8d0f
--- /dev/null
+++ b/tests/data/openpgp-encrypted-attachment-gpgol.plain
@@ -0,0 +1,8 @@
+Hallo
+
+I’m a mime mail sent by Outlook with GpgOL.
+
+Ümlàut’s are 💩
+
+Attachment is added, too.
+
diff --git a/tests/t-parser.cpp b/tests/t-parser.cpp
index d1c260e..bc68c5e 100644
--- a/tests/t-parser.cpp
+++ b/tests/t-parser.cpp
@@ -87,6 +87,12 @@ struct
NULL,
1,
"us-ascii"},
+ { DATADIR "/openpgp-encrypted-attachment-gpgol.mbox",
+ MSGTYPE_GPGOL_MULTIPART_ENCRYPTED,
+ DATADIR "/openpgp-encrypted-attachment-gpgol.plain",
+ NULL,
+ 1,
+ "utf-8"},
{ NULL, MSGTYPE_UNKNOWN, NULL, NULL, 0, NULL }
};
@@ -163,15 +169,12 @@ int main()
}
fclose (expected_html_body);
}
- if (test_data[i].attachment_cnt)
+ int actual = (int)parser.get_attachments().size();
+ if (actual != test_data[i].attachment_cnt)
{
- int actual = (int)parser.get_attachments().size();
- if (actual != test_data[i].attachment_cnt)
- {
- fprintf (stderr, "Attachment count mismatch. Actual: %i Expected: %i\n",
- actual, test_data[i].attachment_cnt);
- exit(1);
- }
+ fprintf (stderr, "Attachment count mismatch. Actual: %i Expected: %i\n",
+ actual, test_data[i].attachment_cnt);
+ exit(1);
}
if (test_data[i].expected_charset)
{
commit e482433121af2301ca34d5a9f45bae7378ae2464
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Wed Sep 28 16:14:10 2016 +0200
tests: Fix run-parser
* tests/run-parser.cpp (main): Actually parse again.
diff --git a/tests/run-parser.cpp b/tests/run-parser.cpp
index b6db615..286bd51 100644
--- a/tests/run-parser.cpp
+++ b/tests/run-parser.cpp
@@ -106,6 +106,7 @@ int main(int argc, char **argv)
{
ParseController parser(fp_in, msgtype);
+ parser.parse();
std::cout << "Parse error: " << parser.get_formatted_error ();
std::cout << "\nDecrypt result:\n" << parser.decrypt_result()
<< "\nVerify result:\n" << parser.verify_result()
commit e0cd79c6ef2afd91e3594cb1d8fc8e662f03c5b1
Author: Andre Heinecke <aheinecke at intevation.de>
Date: Wed Sep 28 16:10:54 2016 +0200
Simplify / Fix attachment collection
* src/mimedataprovider.cpp (mime_context): Remove redundant
collect_attachment.
(t2body): Remove collect_attachment artifact. Infer from
crypto data / bodies / nesting level.
--
The old collect attachment handling rooted in the fact that
the old parser collected everything as attachments, even
the body. Now that we collect the body differently we don't
need to collect_attachment this way. We now collect
every nested parts that are not inline text as attachments
if they are not crypto_data.
diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp
index 20f2fe1..59fcd38 100644
--- a/src/mimedataprovider.cpp
+++ b/src/mimedataprovider.cpp
@@ -67,7 +67,6 @@ struct mime_context
int body_seen; /* True if we have seen a part we consider the
body of the message. */
- int collect_attachment; /* True if we are collecting an attachment */
std::shared_ptr<Attachment> current_attachment; /* A pointer to the current
attachment */
int collect_body; /* True if we are collcting the body */
@@ -325,38 +324,37 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg)
rfc822parse_release_field (field); /* (Content-type) */
ctx->in_data = 1;
- /* Need to start an attachment if we have seen a content disposition
- other then the inline type. */
- if (is_text && not_inline_text)
- ctx->collect_attachment = 1;
-
log_mime_parser ("%s:%s: this body: nesting=%d partno=%d is_text=%d"
- " charset=\"%s\"\n",
+ " charset=\"%s\"\n body_seen=%d not_inline_text=%d",
SRCNAME, __func__,
ctx->nesting_level, ctx->part_counter, is_text,
- ctx->mimestruct_cur->charset?ctx->mimestruct_cur->charset:"");
+ ctx->mimestruct_cur->charset?ctx->mimestruct_cur->charset:"",
+ ctx->body_seen, not_inline_text);
- /* If this is a text part, decide whether we treat it as our body. */
- if (is_text && !not_inline_text)
+ /* If this is a text part, decide whether we treat it as one
+ of our bodies.
+ */
+ if ((is_text && !not_inline_text))
{
- ctx->collect_attachment = 1;
- ctx->body_seen = 1;
if (is_text == 2)
{
+ ctx->body_seen = 2;
ctx->collect_html_body = 1;
ctx->collect_body = 0;
}
else
{
+ ctx->body_seen = 1;
ctx->collect_body = 1;
ctx->collect_html_body = 0;
}
}
- else if (ctx->collect_attachment)
+ else if (!ctx->collect_crypto_data && ctx->nesting_level >= 1)
{
- /* Now that if we have an attachment prepare a new MAPI
- attachment. */
+ /* Treat it as an attachment. */
ctx->current_attachment = provider->create_attachment();
+ ctx->collect_body = 0;
+ ctx->collect_html_body = 0;
}
return 0;
@@ -387,7 +385,6 @@ message_cb (void *opaque, rfc822parse_event_t event,
SRCNAME, __func__);
ctx->start_hashing = 1;
ctx->collect_crypto_data = 1;
- ctx->body_seen = 1;
/* Create a fake MIME structure. */
/* Fixme: We might want to take it from the enclosing message. */
{
@@ -448,7 +445,6 @@ message_cb (void *opaque, rfc822parse_event_t event,
case RFC822PARSE_LAST_BOUNDARY:
ctx->any_boundary = 1;
ctx->in_data = 0;
- ctx->collect_attachment = 0;
ctx->collect_body = 0;
if (ctx->start_hashing == 2 && ctx->hashing_level == ctx->nesting_level)
@@ -615,11 +611,12 @@ MimeDataProvider::collect_input_lines(const char *input, size_t insize)
m_crypto_data.write (linebuf, pos);
m_mime_ctx->collect_crypto_data = 2;
}
- if (m_mime_ctx->in_data && m_mime_ctx->collect_attachment)
+ if (m_mime_ctx->in_data && !m_mime_ctx->collect_signature &&
+ !m_mime_ctx->collect_crypto_data)
{
/* We are inside of an attachment part. Write it out. */
- if (m_mime_ctx->collect_attachment == 1) /* Skip the first line. */
- m_mime_ctx->collect_attachment = 2;
+ if (m_mime_ctx->in_data == 1) /* Skip the first line. */
+ m_mime_ctx->in_data = 2;
int slbrk = 0;
if (m_mime_ctx->is_qp_encoded)
-----------------------------------------------------------------------
Summary of changes:
src/mimedataprovider.cpp | 37 +++++++++----------
tests/data/openpgp-encrypted-attachment-gpgol.mbox | 42 ++++++++++++++++++++++
.../data/openpgp-encrypted-attachment-gpgol.plain | 8 +++++
tests/run-parser.cpp | 1 +
tests/t-parser.cpp | 19 +++++-----
5 files changed, 79 insertions(+), 28 deletions(-)
create mode 100644 tests/data/openpgp-encrypted-attachment-gpgol.mbox
create mode 100644 tests/data/openpgp-encrypted-attachment-gpgol.plain
hooks/post-receive
--
GnuPG extension for MS Outlook
http://git.gnupg.org
More information about the Gnupg-commits
mailing list