handle SASL failures

This commit is contained in:
lumi 2017-02-24 17:20:00 +01:00
parent 26d2710c1f
commit 158d871df9
2 changed files with 6 additions and 0 deletions

View file

@ -191,6 +191,11 @@ impl Client {
} }
} }
} }
else if n.is("failure", ns::SASL) {
let msg = n.text();
let inner = if msg == "" { None } else { Some(msg) };
return Err(Error::SaslError(inner));
}
else if n.is("iq", ns::CLIENT) && n.has_child("bind", ns::BIND) { else if n.is("iq", ns::CLIENT) && n.has_child("bind", ns::BIND) {
return Ok(()); return Ok(());
} }

View file

@ -24,6 +24,7 @@ pub enum Error {
OpenSslErrorStack(ErrorStack), OpenSslErrorStack(ErrorStack),
MinidomError(MinidomError), MinidomError(MinidomError),
Base64Error(Base64Error), Base64Error(Base64Error),
SaslError(Option<String>),
StreamError, StreamError,
EndOfDocument, EndOfDocument,
} }