Allow sender timestamp to be in the future

This can happen due to unsynchronized clocks or
when "smeared" timestamp is used as the sender sends
multiple messages without delay.
This commit is contained in:
link2xt
2022-10-30 10:25:27 +00:00
parent b1c6c40fa7
commit d81579730e
2 changed files with 5 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
### API-Changes
### Changes
- allow sender timestamp to be in the future, but not too much
### Fixes
- `dc_search_msgs()` returns unaccepted requests #3694

View File

@@ -173,10 +173,13 @@ pub(crate) async fn receive_imf_inner(
.await?;
let rcvd_timestamp = smeared_time(context).await;
// Sender timestamp is allowed to be a bit in the future due to
// unsynchronized clocks, but not too much.
let sent_timestamp = mime_parser
.get_header(HeaderDef::Date)
.and_then(|value| mailparse::dateparse(value).ok())
.map_or(rcvd_timestamp, |value| min(value, rcvd_timestamp));
.map_or(rcvd_timestamp, |value| min(value, rcvd_timestamp + 60));
// Add parts
let received_msg = add_parts(