diff options
Diffstat (limited to 'jabber/src/jabber_stream.rs')
-rw-r--r-- | jabber/src/jabber_stream.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/jabber/src/jabber_stream.rs b/jabber/src/jabber_stream.rs index 6fa92b5..302350d 100644 --- a/jabber/src/jabber_stream.rs +++ b/jabber/src/jabber_stream.rs @@ -133,10 +133,13 @@ where let sasl = SASLClient::new(sasl_config); let mut offered_mechs: Vec<&Mechname> = Vec::new(); for mechanism in &mechanisms.mechanisms { - offered_mechs.push(Mechname::parse(mechanism.as_bytes())?) + offered_mechs + .push(Mechname::parse(mechanism.as_bytes()).map_err(|e| Error::SASL(e.into()))?) } debug!("{:?}", offered_mechs); - let mut session = sasl.start_suggested(&offered_mechs)?; + let mut session = sasl + .start_suggested(&offered_mechs) + .map_err(|e| Error::SASL(e.into()))?; let selected_mechanism = session.get_mechname().as_str().to_owned(); debug!("selected mech: {:?}", selected_mechanism); let mut data: Option<Vec<u8>>; @@ -174,7 +177,7 @@ where ServerResponse::Success(success) => { data = success.clone().map(|success| success.as_bytes().to_vec()) } - ServerResponse::Failure(failure) => return Err(Error::Authentication(failure)), + ServerResponse::Failure(failure) => return Err(Error::SASL(failure.into())), } debug!("we went first"); } @@ -205,7 +208,7 @@ where ServerResponse::Success(success) => { data = success.clone().map(|success| success.as_bytes().to_vec()) } - ServerResponse::Failure(failure) => return Err(Error::Authentication(failure)), + ServerResponse::Failure(failure) => return Err(Error::SASL(failure.into())), } } } |