aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/mailboxTest.cpp
diff options
context:
space:
mode:
authorJan Engelhardt <[email protected]>2018-11-29 20:25:47 +0000
committerJan Engelhardt <[email protected]>2019-01-25 07:11:07 +0000
commitd1190b496faa754a757aba79f88dcd7e31d6d500 (patch)
tree4a8a599c0e64d58818bebc761f94acdee189b847 /tests/parser/mailboxTest.cpp
parenttests: add more malformation tests to mailboxTest (diff)
downloadvmime-d1190b496faa754a757aba79f88dcd7e31d6d500.tar.gz
vmime-d1190b496faa754a757aba79f88dcd7e31d6d500.zip
Improve address parser for malformed mailbox specifications
Spammers use "Name <addr> <addr>" to trick some parsers. My expectations as to what the outcome should be is presented in the updated mailboxTest.cpp. The DFA in mailbox::parseImpl is hereby redone so as to pick the rightmost address-looking portion as the address, rather than something in between. While doing so, it will also no longer mangle the name part anymore (it does this by keeping a "as_if_name" variable around until the end).
Diffstat (limited to 'tests/parser/mailboxTest.cpp')
-rw-r--r--tests/parser/mailboxTest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/parser/mailboxTest.cpp b/tests/parser/mailboxTest.cpp
index a0d1b694..23d1b4ac 100644
--- a/tests/parser/mailboxTest.cpp
+++ b/tests/parser/mailboxTest.cpp
@@ -154,20 +154,20 @@ VMIME_TEST_SUITE_BEGIN(mailboxTest)
VASSERT_EQ("email", "[email protected]", mbox.getEmail());
- VASSERT_EQ("name", vmime::text("[email protected]"), mbox.getName());
+ VASSERT_EQ("name", vmime::text("[email protected] [email protected]"), mbox.getName());
VASSERT_EQ("email", "[email protected]", mbox.getEmail());
mbox.parse("Foo <bar<[email protected]>");
- VASSERT_EQ("name", vmime::text("Foobar"), mbox.getName());
+ VASSERT_EQ("name", vmime::text("Foo <bar"), mbox.getName());
VASSERT_EQ("email", "[email protected]", mbox.getEmail());
mbox.parse("Foo <[email protected]> <[email protected]>");
- VASSERT_EQ("name", vmime::text("Foo"), mbox.getName());
- VASSERT_EQ("email", "[email protected]", mbox.getEmail());
+ VASSERT_EQ("name", vmime::text("Foo <[email protected]>"), mbox.getName());
+ VASSERT_EQ("email", "[email protected]", mbox.getEmail());
mbox.parse("Foo <[email protected]> Bar <[email protected]>");
- VASSERT_EQ("name", vmime::text("Foo"), mbox.getName());
- VASSERT_EQ("email", "[email protected]", mbox.getEmail());
+ VASSERT_EQ("name", vmime::text("Foo <[email protected]> Bar"), mbox.getName());
+ VASSERT_EQ("email", "[email protected]", mbox.getEmail());
}
VMIME_TEST_SUITE_END