Diffusion GpgOL 93a90dd286f4

Add safeguard against plaintext leaks after close

Authored by aheinecke on Jul 14 2019, 11:25 AM.


Add safeguard against plaintext leaks after close

* src/mail.cpp (Mail::close): Add saveguards against plaintext

The underlying new understanding of this fix is that
close with discard changes does not neccessarily discard
changes in the data model when the same mail is opened
multiple times.

First we improve by:

mail->setCloseTriggered (false);

After our close, that the user is not asked to save changes
when the mail is opened for the third time.

Then by checking if there is still a body in the data
model we ensure that we do not allow the next write
to pass. The attachment check additionally checks
for leftover attachments.

This can create problems with PGP Partitioned mails
which we might have to improve later by checking with
gpgme_data_identify if it is actually plain text.

But this affects only the moving of mails and annoying
questions when closing outlook. So it should not be
too bad.