This commit is contained in:
Nadja Reitzenstein 2022-03-13 23:58:03 +01:00
parent 15f31ffd7c
commit 75c449c83a
2 changed files with 14 additions and 5 deletions

View File

@ -99,12 +99,18 @@ impl connection_capnp::bootstrap::Server for Bootstrap {
let mechname = mechanism.as_bytes(); let mechname = mechanism.as_bytes();
let state = if let Ok(mechname) = Mechname::new(mechname) { let state = if let Ok(mechname) = Mechname::new(mechname) {
if let Ok(session) = self.ctx.server_start(mechname) { match self.ctx.server_start(mechname) {
State::Running(session) Ok(session) => {
} else { debug!(self.log, "Starting session using {}", mechname);
State::Aborted State::Running(session)
},
Err(error) => {
debug!(self.log, "Session start failed {:?}", error);
State::Aborted
}
} }
} else { } else {
debug!(self.log, "Invalid mechname {:?}", mechname);
State::InvalidMechanism State::InvalidMechanism
}; };

View File

@ -138,6 +138,7 @@ impl authentication::Server for Auth {
let mut out = Cursor::new(Vec::new()); let mut out = Cursor::new(Vec::new());
match session.step(Some(data), &mut out) { match session.step(Some(data), &mut out) {
Ok(Step::Done(data)) => { Ok(Step::Done(data)) => {
trace!(self.log, "Authentication done!");
self.state = State::Finished; self.state = State::Finished;
let uid = pry!(session.get_property::<AuthId>().ok_or(capnp::Error::failed( let uid = pry!(session.get_property::<AuthId>().ok_or(capnp::Error::failed(
@ -173,10 +174,12 @@ impl authentication::Server for Auth {
))); )));
} }
Ok(Step::NeedsMore(_)) => { Ok(Step::NeedsMore(_)) => {
trace!(self.log, "Authentication wants more data");
self.state = State::Aborted; self.state = State::Aborted;
self.build_error(builder); self.build_error(builder);
} }
Err(_) => { Err(error) => {
trace!(self.log, "Authentication errored: {}", error);
self.state = State::Aborted; self.state = State::Aborted;
self.build_error(builder); self.build_error(builder);
} }