From 158d871df91f8d6d62e398371ce97e647cf5eeed Mon Sep 17 00:00:00 2001 From: lumi Date: Fri, 24 Feb 2017 17:20:00 +0100 Subject: [PATCH] handle SASL failures --- src/client.rs | 5 +++++ src/error.rs | 1 + 2 files changed, 6 insertions(+) diff --git a/src/client.rs b/src/client.rs index b5f8f4e..70bf176 100644 --- a/src/client.rs +++ b/src/client.rs @@ -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) { return Ok(()); } diff --git a/src/error.rs b/src/error.rs index 1d8e373..81f41fe 100644 --- a/src/error.rs +++ b/src/error.rs @@ -24,6 +24,7 @@ pub enum Error { OpenSslErrorStack(ErrorStack), MinidomError(MinidomError), Base64Error(Base64Error), + SaslError(Option), StreamError, EndOfDocument, }