Fix #1753 In opportunistic chats, a wrongly signed message should be readable eventually

This commit is contained in:
Hocuri
2020-08-02 10:49:45 +02:00
committed by link2xt
parent 6e8808f69b
commit ac232a5dbf
2 changed files with 21 additions and 14 deletions

View File

@@ -141,10 +141,14 @@ impl MimeMessage {
// Handle any gossip headers if the mail was encrypted. See section
// "3.6 Key Gossip" of https://autocrypt.org/autocrypt-spec-1.1.0.pdf
let gossip_headers = decrypted_mail.headers.get_all_values("Autocrypt-Gossip");
gossipped_addr =
update_gossip_peerstates(context, message_time, &mail, gossip_headers)
.await?;
// but only if the mail was correctly signed:
if !signatures.is_empty() {
let gossip_headers =
decrypted_mail.headers.get_all_values("Autocrypt-Gossip");
gossipped_addr =
update_gossip_peerstates(context, message_time, &mail, gossip_headers)
.await?;
}
// let known protected headers from the decrypted
// part override the unencrypted top-level
@@ -200,6 +204,12 @@ impl MimeMessage {
parser.heuristically_parse_ndn(context).await;
parser.parse_headers(context)?;
if parser.signatures.is_empty() {
for part in parser.parts.iter_mut() {
part.error = "No valid signature".to_string();
}
}
Ok(parser)
}