Home GnuPG
Diffusion GpgOL 9d10ff22928a

Add safety check to prevent unencrypted send

Description

Add safety check to prevent unencrypted send

* src/mail.cpp (Mail::has_crypted_or_empty_body): New.
(Mail::update_crypt_oom): Use it.
(has_crypt_or_empty_body_oom): New helper.
* src/mailitem-events.cpp (EVENT_SINK_INVOKE): Check if
body is empty or a crypt message before passing send on
a crypto mail.

The idea is to check as a last ditch if before sending
a mail that "should" be encrypted if it has either
an empty body or a PGP/Inline body.
This won't help of course for empty mails with attachments
but should work in most cases.

The codepath is never hit intentional so the error
message points to a bug. It's just an additional
saveguard.

Details