From f358bdbff121693fc3e44b5c2d853f515e4d371e Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sun, 16 Oct 2022 14:52:16 +0200 Subject: [PATCH] Some fixes from link2xt's review --- src/{authres_handling.rs => authres.rs} | 4 ++-- src/config.rs | 2 +- src/decrypt.rs | 22 ++++++++++++++++------ src/headerdef.rs | 1 + src/lib.rs | 2 +- src/sql/migrations.rs | 1 - src/tools.rs | 4 ++-- 7 files changed, 23 insertions(+), 13 deletions(-) rename src/{authres_handling.rs => authres.rs} (99%) diff --git a/src/authres_handling.rs b/src/authres.rs similarity index 99% rename from src/authres_handling.rs rename to src/authres.rs index dde69569c..538f52604 100644 --- a/src/authres_handling.rs +++ b/src/authres.rs @@ -469,7 +469,7 @@ Authentication-Results: box.hispanilandia.net; spf=pass smtp.mailfrom=adbenitez@ async fn test_realworld_authentication_results() -> Result<()> { let mut test_failed = false; - let dir = tools::read_dir("test-data/message/dkimchecks-2022-09-28/") + let dir = tools::read_dir("test-data/message/dkimchecks-2022-09-28/".as_ref()) .await .unwrap(); let mut bytes = Vec::new(); @@ -504,7 +504,7 @@ Authentication-Results: box.hispanilandia.net; spf=pass smtp.mailfrom=adbenitez@ } // Simulate receiving all emails once, so that we have the correct authserv-ids - let mut dir = tools::read_dir(entry.path()).await.unwrap(); + let mut dir = tools::read_dir(&entry.path()).await.unwrap(); // The ordering in which the emails are received can matter; // the test _should_ pass for every ordering. diff --git a/src/config.rs b/src/config.rs index 612412aa5..a917ab907 100644 --- a/src/config.rs +++ b/src/config.rs @@ -188,7 +188,7 @@ pub enum Config { /// Space-separated list of all the authserv-ids which we believe /// may be the one of our email server. /// - /// See `crate::authres_handling::update_authservid_candidates`. + /// See `crate::authres::update_authservid_candidates`. AuthservidCandidates, } diff --git a/src/decrypt.rs b/src/decrypt.rs index 53a2dd88d..2e3fd7809 100644 --- a/src/decrypt.rs +++ b/src/decrypt.rs @@ -7,8 +7,8 @@ use mailparse::ParsedMail; use mailparse::SingleInfo; use crate::aheader::Aheader; -use crate::authres_handling; -use crate::authres_handling::handle_authres; +use crate::authres; +use crate::authres::handle_authres; use crate::contact::addr_cmp; use crate::context::Context; use crate::key::{DcKey, Fingerprint, SignedPublicKey, SignedSecretKey}; @@ -105,7 +105,7 @@ pub struct DecryptionInfo { /// means out-of-order message arrival, We don't modify the /// peerstate in this case. pub message_time: i64, - pub(crate) dkim_results: authres_handling::DkimResults, + pub(crate) dkim_results: authres::DkimResults, } /// Returns a reference to the encrypted payload of a ["Mixed @@ -273,6 +273,9 @@ fn keyring_from_peerstate(peerstate: &Option) -> Keyring>( } } -pub async fn read_dir(path: impl AsRef) -> Result> { - let res = tokio_stream::wrappers::ReadDirStream::new(fs::read_dir(path.as_ref()).await?) +pub async fn read_dir(path: &Path) -> Result> { + let res = tokio_stream::wrappers::ReadDirStream::new(fs::read_dir(path).await?) .try_collect() .await?; Ok(res)