[Kde-pim] Review Request: Keep the message integrity in akonadi

Andras Mantia amantia at kde.org
Sat Jul 11 09:38:56 BST 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/988/
-----------------------------------------------------------

Review request for KDE PIM.


Summary
-------

Currently when payloadData() is requested for a KMime::Message, the returned data is not *exactly* the same as the one that was stored. This breaks signature verfications (and probably encryption as well). The root of the problem is KMime::Content::assemble() that calls assembleHeaders() that recreates the header string from the header information. I see no reason to call assemble() for a message that was just retrieved from the database. With this change, the returned header matches the stored one.
A simple testcas looks like this:

//data is the message as text, expectedheader is a header from a sub content, not the newline between text/plain and charset
  QByteArray expectedHeader = "Content-Type: text/plain;\n\
  charset=\"us-ascii\"\n\
Content-Transfer-Encoding: 7bit\n";

  KMime::Message *message = new KMime::Message;
  message->setContent( data );
  message->parse();
  QCOMPARE(message->contents().at(0)->head(), expectedHeader); /passes
  i.setPayload( MessagePtr( message ) );
  QVERIFY( i.hasPayload<MessagePtr>() ); //passes
  qDebug() << i.payloadData(); //THIS IS THE IMPORTANT LINE!
  MessagePtr readMessage = i.payload<MessagePtr>();
  QCOMPARE(readMessage->contents().at(0)->head(), expectedHeader); //passes if the payloadData() line is disabled, fails otherwise


Diffs
-----

  /trunk/KDE/kdepim/akonadi/plugins/akonadi_serializer_mail.cpp 994530 

Diff: http://reviewboard.kde.org/r/988/diff


Testing
-------

Tested with mailreader and the above testcase, that I added to kdepimlibs/akonadi/test/itemtest.cpp (not sure if it belongs there).


Thanks,

Andras

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list