aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bayou.rs5
-rw-r--r--src/imap/command/anonymous.rs5
-rw-r--r--src/login/demo_provider.rs13
-rw-r--r--src/login/mod.rs2
-rw-r--r--src/server.rs2
5 files changed, 15 insertions, 12 deletions
diff --git a/src/bayou.rs b/src/bayou.rs
index 7253a30..c6a7ac0 100644
--- a/src/bayou.rs
+++ b/src/bayou.rs
@@ -450,10 +450,7 @@ impl K2vWatch {
) {
let mut row = match Weak::upgrade(&self_weak) {
Some(this) => this.target.clone(),
- None => {
- error!("can't start loop");
- return;
- }
+ None => return,
};
while let Some(this) = Weak::upgrade(&self_weak) {
diff --git a/src/imap/command/anonymous.rs b/src/imap/command/anonymous.rs
index d258bd3..6ba19cf 100644
--- a/src/imap/command/anonymous.rs
+++ b/src/imap/command/anonymous.rs
@@ -21,7 +21,10 @@ pub async fn dispatch(ctx: AnonymousContext<'_>) -> Result<(Response, flow::Tran
CommandBody::Capability => ctx.capability().await,
CommandBody::Logout => ctx.logout().await,
CommandBody::Login { username, password } => ctx.login(username, password).await,
- _ => Ok((Response::no("Command unavailable")?, flow::Transition::None)),
+ cmd => {
+ tracing::warn!("Unknown command {:?}", cmd);
+ Ok((Response::no("Command unavailable")?, flow::Transition::None))
+ }
}
}
diff --git a/src/login/demo_provider.rs b/src/login/demo_provider.rs
index 0efb37c..11c7d54 100644
--- a/src/login/demo_provider.rs
+++ b/src/login/demo_provider.rs
@@ -1,14 +1,14 @@
use crate::login::*;
use crate::storage::*;
-pub struct DemoLoginProvider{
+pub struct DemoLoginProvider {
keys: CryptoKeys,
in_memory_store: in_memory::MemDb,
}
impl DemoLoginProvider {
pub fn new() -> Self {
- Self {
+ Self {
keys: CryptoKeys::init(),
in_memory_store: in_memory::MemDb::new(),
}
@@ -26,8 +26,8 @@ impl LoginProvider for DemoLoginProvider {
if password != "hunter2" {
bail!("wrong password");
- }
-
+ }
+
let storage = self.in_memory_store.builder("alice").await;
let keys = self.keys.clone();
@@ -43,6 +43,9 @@ impl LoginProvider for DemoLoginProvider {
let storage = self.in_memory_store.builder("alice").await;
let public_key = self.keys.public.clone();
- Ok(PublicCredentials { storage, public_key })
+ Ok(PublicCredentials {
+ storage,
+ public_key,
+ })
}
}
diff --git a/src/login/mod.rs b/src/login/mod.rs
index 6f2ca31..4a1dee1 100644
--- a/src/login/mod.rs
+++ b/src/login/mod.rs
@@ -1,6 +1,6 @@
+pub mod demo_provider;
pub mod ldap_provider;
pub mod static_provider;
-pub mod demo_provider;
use base64::Engine;
use std::sync::Arc;
diff --git a/src/server.rs b/src/server.rs
index 1b8677b..8bfde98 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -11,7 +11,7 @@ use crate::config::*;
use crate::imap;
use crate::lmtp::*;
use crate::login::ArcLoginProvider;
-use crate::login::{ldap_provider::*, static_provider::*, demo_provider::*};
+use crate::login::{demo_provider::*, ldap_provider::*, static_provider::*};
pub struct Server {
lmtp_server: Option<Arc<LmtpServer>>,