From 75c449c83afe678e3ff7b2f53106a4babeec2aa5 Mon Sep 17 00:00:00 2001 From: Nadja Reitzenstein Date: Sun, 13 Mar 2022 23:58:03 +0100 Subject: [PATCH] Fix auth --- src/api.rs | 14 ++++++++++---- src/api/auth.rs | 5 ++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/api.rs b/src/api.rs index 02bacea..c9ae961 100644 --- a/src/api.rs +++ b/src/api.rs @@ -99,12 +99,18 @@ impl connection_capnp::bootstrap::Server for Bootstrap { let mechname = mechanism.as_bytes(); let state = if let Ok(mechname) = Mechname::new(mechname) { - if let Ok(session) = self.ctx.server_start(mechname) { - State::Running(session) - } else { - State::Aborted + match self.ctx.server_start(mechname) { + Ok(session) => { + debug!(self.log, "Starting session using {}", mechname); + State::Running(session) + }, + Err(error) => { + debug!(self.log, "Session start failed {:?}", error); + State::Aborted + } } } else { + debug!(self.log, "Invalid mechname {:?}", mechname); State::InvalidMechanism }; diff --git a/src/api/auth.rs b/src/api/auth.rs index 7d518b0..0a01038 100644 --- a/src/api/auth.rs +++ b/src/api/auth.rs @@ -138,6 +138,7 @@ impl authentication::Server for Auth { let mut out = Cursor::new(Vec::new()); match session.step(Some(data), &mut out) { Ok(Step::Done(data)) => { + trace!(self.log, "Authentication done!"); self.state = State::Finished; let uid = pry!(session.get_property::().ok_or(capnp::Error::failed( @@ -173,10 +174,12 @@ impl authentication::Server for Auth { ))); } Ok(Step::NeedsMore(_)) => { + trace!(self.log, "Authentication wants more data"); self.state = State::Aborted; self.build_error(builder); } - Err(_) => { + Err(error) => { + trace!(self.log, "Authentication errored: {}", error); self.state = State::Aborted; self.build_error(builder); }