Browse Source

implement §6.4.2 (send single equals sign)

Instead of an inital payload, send a single equals sign.
( https://tools.ietf.org/html/rfc6120#section-6.4.2 )
master
Philipp Balzarek 12 years ago
parent
commit
294face290
  1. 6
      source/Network/Xmpp/Sasl/Common.hs

6
source/Network/Xmpp/Sasl/Common.hs

@ -134,10 +134,14 @@ quote x = BS.concat ["\"",x,"\""] @@ -134,10 +134,14 @@ quote x = BS.concat ["\"",x,"\""]
saslInit :: Text.Text -> Maybe BS.ByteString -> ErrorT AuthFailure (StateT StreamState IO) ()
saslInit mechanism payload = do
r <- lift . pushElement . saslInitE mechanism $
Text.decodeUtf8 . B64.encode <$> payload
Text.decodeUtf8 . encodeEmpty . B64.encode <$> payload
case r of
Right () -> return ()
Left e -> throwError $ AuthStreamFailure e
where
-- §6.4.2
encodeEmpty "" = "="
encodeEmpty x = x
-- | Pull the next element.
pullSaslElement :: ErrorT AuthFailure (StateT StreamState IO) SaslElement

Loading…
Cancel
Save