Version: 4.5 (using Devel) OS: Linux Installed from: Compiled sources The objecttreeparser is still not completely ported. Some bugs: - It creates strange mime structures during parsing of embedded messages - trueFromAddress() got lost in the port, now signatures and photos in embedded messages will not work anymore Ideally, the objectreeparser should have more unit tests, especially for parsing crypto messages correctly. Those have been proven to be brittle in the past. Possible test combinations: - signed, encrypted, signed + encrypted - inline, detached, opaque - broken signatures - chiasmus - old-style mailman messages - embedded messages - embedded messages with signatures - ...
> It creates strange mime structures during parsing of embedded messages That can be seen very good when using the mime part tree viewer, the tree grows and grows and grows...
*** Bug 226408 has been marked as a duplicate of this bug. ***
> It creates strange mime structures during parsing of embedded messages I fixed that one by adding special support for encapsulated messages to KMime, the OTP now doesn't modify the MIME structure anymore, for encapsulated messages.
Here are the results/TODO list after an IRC discussion: 1) Make sure that saving the message as mbox saves the original encrypted message, not the modified one 2) What should happen when deleting/edit an attachment that is part of the encrypted message? Check what KMail 1 does in this case. 3) Be careful when saving back the message (for some other reason than deleting/editing attachments), it should save back the original message, not the modified one 4) Viewing encrypted/signed messages has two problems right now, see http://imagebin.org/91863: a) In the viewer, the original encrypted nodes are shown as attachments in the viewer. Didn't happen in KMail 1. b) The signature is marked as invalid, even though it is valid I created the test message with KMail 1, in the following way: a) In the composer, add an attachment and mark the message as signed and encrypted. Either send the message to yourself or save as draft, if the "Never sign/encrypt when saving as draft" option is disabled b) Right-click the message in the message list and save as mbox c) In KMail 2, import the message using File->Import Messages 5) There is a special option to always save the decrypted form of the message once it is displayed. This option is storeDisplayedMessagesUnencrypted(). This is done in ViewerPrivate::parseMsg(), which calls objectTreeToDecryptedMsg(). This does currently not work, as some TODO comments indicate. Note that the decrypted message is _not_ the same as the modified message the OTP creates when decrypting a message. The OTP still leaves the old encrypted nodes around, while objectTreeToDecryptedMsg() removes them, so that the message is truely decrypted and viewable by everyone. objectTreeToDecryptedMsg() should be unit-tested. 6) Make sure insertAndParseChildNode() works, and check all if all callers work. One example are old-style mailman messages, but I think there are more 7) trueFromAddress() was incorrectly ported. Check the KMail 1 sources for it. trueFromAddress() is used when displaying encapsulated messages, for example when fetching the contact photo or when verifying the signature of encapsulated messages. This was ported to always use the From address of the top-level node, so it doesn't work anymore for encapsulated messages. 8) As this stuff is complicated, especially the crypto stuff and the parts that modify the message, unit tests are needed. To get the crypto stuff unit tested, one needs special unit test keys, and set the gnupg home to the unit test dir. Have a look at how the messagecomposer does it, in kdepim/messagecomposer/tests/gnupg_home and the setenv() calls in ComposerTestUtil::getKeys()
Created attachment 42523 [details] Example mailman message insertAndParseNewChildNode() is used by the crypto stuff and by processMailmanMessage(). I don't see why processMailmanMessage() needs to modify the message, it could be changed to not use insertAndParseNewChildNode(), probably. Or it could be ported and made to work. Anyway, I attached a test mailman message here. Can be also found at the kdabtest1 account in the "test mails" folder.
SVN commit 1112524 by amantia: 1) clean up and rename insertAndParseNewChildNode to reflect what it is really doing. From now on the mime tree is not modified when a message is decrypted or a mailman message is processed. 2) fix signature verification for messages with attachments 3) fix displaying of mailman messages 4) don't show the encrypted data as attachments for decrypted messages 5) introduce a helper class to get the from() as a QString from a message CCBUG: 223441 M +20 -1 nodehelper.cpp M +4 -0 nodehelper.h M +37 -75 objecttreeparser.cpp M +3 -8 objecttreeparser.h WebSVN link: http://websvn.kde.org/?view=rev&revision=1112524
Adding some notes after a short IRC discussion: Right now, createAndParseTempNode() deletes the node after calling parseObjectTree() on it. This means all state attached to the node gets lost, i.e. the mementos and all the maps in the NodeHelper, like mEncryptionState. The OTP is called multiple times on the same root node, for async crypto stuff and also for things like expanded/collapsed quote marks, so the state should not get lost at all. Probably the temp node should be stored in NodeHelper instead. The attachment quick list in the fancy header right now does not work for attachments in encrypted messages. Same with the mimetree viewer, ideally it would only show the decrypted parts, and not the original encrypted one, once it has been decrypted. Clicking on nodes in the mimetree viewer should also work for stuff inside encrypted nodes. mStoredMessagePayload can now be removed, and probably also the "processed source" tab in the source viewer. Or maybe the "processed source" tab should show the source of the temp nodes. Note to self: Update the OTP documentation about insertAndParseChildNode, since it has changed so much now.
Another point: Attachment actions, like saving them, should also work in encrypted nodes, no idea if that works currently. Before, it worked, since the original MIME tree was modified.
> 1) Make sure that saving the message as mbox saves the original encrypted > message, not the modified one Fixed, as the OTP doesn't modify the original message anymore. mStoredMessagePayload can also be removed again. > 2) What should happen when deleting/edit an attachment that is part of the > encrypted message? Check what KMail 1 does in this case. This is buggy in KMail 1, attachment deletion and editing inside of decrypted nodes does not work. Easiest way around this is to just disable those actions for those temp nodes. > 3) Be careful when saving back the message (for some other reason than > deleting/editing attachments), it should save back the original message, > not the modified one Fixed as well, same reason as 1). > a) In the viewer, the original encrypted nodes are shown as attachments in > the viewer. Didn't happen in KMail 1. Fixed according to Andras. > b) The signature is marked as invalid, even though it is valid Fixed as well. > storeDisplayedMessagesUnencrypted(). For all of the store unencrypted message stuff, we discussed that it is probably best to rewrite objectTreeToDecryptedMsg() and base it on the temporary nodes createAndParseChildNodes() creates. > 6) Make sure insertAndParseChildNode() works, and check all if all callers > work. One example are old-style mailman messages, but I think there are more Old style mailman messages are fixed, and crypto stuff probably as well. > 7) trueFromAddress() was incorrectly ported This is fixed now I guess, after processRfc822Subtype was changed. I might need to double-check this though. > Right now, createAndParseTempNode() deletes the node after calling > parseObjectTree() on it. We decided on store the newly created nodes in the NodeHelper so that the nodes can be found again when the OTP is run again on the same tree, in async mode. > The attachment quick list in the fancy header right now does not work Probably the easiest way to fix this it to change the AttachmentUrlHander to take attachments inside of temp nodes into account. This would probably also fix attachments actions such as save as and others. It might be an idea to make the mime tree model aware of temp nodes as well, since we need to be able to see the decrypted nodes in the mime tree viewer.
Closing this big bug report now, I split out stuff into new bug reports. https://bugs.kde.org/show_bug.cgi?id=236732 https://bugs.kde.org/236725 https://bugs.kde.org/show_bug.cgi?id=236734 https://bugs.kde.org/show_bug.cgi?id=236736 https://bugs.kde.org/show_bug.cgi?id=236737 https://bugs.kde.org/show_bug.cgi?id=236740 https://bugs.kde.org/show_bug.cgi?id=236743 https://bugs.kde.org/show_bug.cgi?id=236748