From eefdee03614db7be1ce741672c339badb069ea3d Mon Sep 17 00:00:00 2001 From: mdecimus Date: Thu, 13 Jun 2024 19:30:19 +0100 Subject: [PATCH] Return OK after a successful ManageSieve SASL authentication flow (fixes #187) --- crates/common/src/scripts/plugins/bayes.rs | 2 -- crates/managesieve/src/op/authenticate.rs | 3 +++ tests/src/imap/managesieve.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/common/src/scripts/plugins/bayes.rs b/crates/common/src/scripts/plugins/bayes.rs index 3ad583a9..b6b9b8e7 100644 --- a/crates/common/src/scripts/plugins/bayes.rs +++ b/crates/common/src/scripts/plugins/bayes.rs @@ -88,8 +88,6 @@ async fn train(ctx: PluginContext<'_>, is_train: bool) -> Variable { return false.into(); } - let c = println!("training: {:?} {}", text, is_spam); - // Train the model let mut model = BayesModel::default(); model.train( diff --git a/crates/managesieve/src/op/authenticate.rs b/crates/managesieve/src/op/authenticate.rs index 8ff32a6f..5b045c36 100644 --- a/crates/managesieve/src/op/authenticate.rs +++ b/crates/managesieve/src/op/authenticate.rs @@ -158,6 +158,9 @@ impl Session { in_flight, }; + let _ = self + .write(&StatusResponse::ok("Authentication successful").into_bytes()) + .await; self.handle_capability("Authentication successful").await } else { match &self.state { diff --git a/tests/src/imap/managesieve.rs b/tests/src/imap/managesieve.rs index e8f7e161..b2f57975 100644 --- a/tests/src/imap/managesieve.rs +++ b/tests/src/imap/managesieve.rs @@ -48,6 +48,7 @@ pub async fn test() { sieve .send("AUTHENTICATE \"PLAIN\" \"AGpkb2VAZXhhbXBsZS5jb20Ac2VjcmV0\"") .await; + sieve.assert_read(ResponseType::Ok).await; sieve .assert_read(ResponseType::Ok) .await