From f0efff2c993173e5f913eb311b7f701271ae4938 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Fri, 14 Oct 2022 14:26:26 +0200 Subject: [PATCH] Clear the dkim_works data when authservid candidates change --- src/authres_handling.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/authres_handling.rs b/src/authres_handling.rs index e869481e7..ba51d8e91 100644 --- a/src/authres_handling.rs +++ b/src/authres_handling.rs @@ -156,6 +156,10 @@ async fn update_authservid_candidates( context .set_config(Config::AuthservidCandidates, Some(&new_config)) .await?; + // Updating the authservid candidates may mean that we now consider + // emails as "failed" which "passed" previously, so we need to + // reset our expectation which DKIMs work. + clear_dkim_works(context).await? } Ok(()) } @@ -235,6 +239,14 @@ async fn set_dkim_works(context: &Context, from_domain: &str) -> Result<()> { Ok(()) } +async fn clear_dkim_works(context: &Context) -> Result<()> { + context + .sql + .execute("DELETE FROM sending_domains", paramsv![]) + .await?; + Ok(()) +} + fn parse_authservid_candidates_config(config: &Option) -> HashSet<&str> { config .as_deref()