Browse Source

Merge branch 'master' of git://github.com/rnons/pontarius-xmpp

master
Philipp Balzarek 12 years ago
parent
commit
c5ec2e3c0a
  1. 3
      pontarius-xmpp.cabal
  2. 4
      source/Network/Xmpp/Lens.hs
  3. 10
      source/Network/Xmpp/Tls.hs
  4. 13
      source/Network/Xmpp/Types.hs

3
pontarius-xmpp.cabal

@ -65,8 +65,7 @@ Library @@ -65,8 +65,7 @@ Library
, stm >=2.1.2.1
, stringprep >=1.0.0
, text >=0.11.1.5
, tls >=1.1.3
, tls-extra >=0.6.0
, tls >=1.2
, transformers >=0.2.2.0
, unbounded-delays >=0.1
, void >=0.5.5

4
source/Network/Xmpp/Lens.hs

@ -105,7 +105,7 @@ import qualified Data.Text as Text @@ -105,7 +105,7 @@ import qualified Data.Text as Text
import Data.Text(Text)
import Data.XML.Types(Element)
import Network.DNS(ResolvConf)
import Network.TLS (TLSParams)
import Network.TLS (ClientParams)
import Network.Xmpp.Concurrent.Types
import Network.Xmpp.IM.Roster.Types
import Network.Xmpp.IM.Message
@ -390,7 +390,7 @@ tlsBehaviourL :: Lens StreamConfiguration TlsBehaviour @@ -390,7 +390,7 @@ tlsBehaviourL :: Lens StreamConfiguration TlsBehaviour
tlsBehaviourL inj sc@StreamConfiguration{tlsBehaviour = x}
= (\x' -> sc{tlsBehaviour = x'}) <$> inj x
tlsParamsL :: Lens StreamConfiguration TLSParams
tlsParamsL :: Lens StreamConfiguration ClientParams
tlsParamsL inj sc@StreamConfiguration{tlsParams = x}
= (\x' -> sc{tlsParams = x'}) <$> inj x

10
source/Network/Xmpp/Tls.hs

@ -107,12 +107,12 @@ tls con = fmap join -- We can have Left values both from exceptions and the @@ -107,12 +107,12 @@ tls con = fmap join -- We can have Left values both from exceptions and the
modify (\s -> s{streamConnectionState = Secured})
return ()
client :: (MonadIO m, CPRG rng) => Params -> rng -> Backend -> m Context
client :: (MonadIO m, CPRG rng) => ClientParams -> rng -> Backend -> m Context
client params gen backend = do
contextNew backend params gen
tlsinit :: (MonadIO m, MonadIO m1) =>
TLSParams
ClientParams
-> Backend
-> m ( Source m1 BS.ByteString
, Sink BS.ByteString m1 ()
@ -164,7 +164,7 @@ mkReadBuffer recv = do @@ -164,7 +164,7 @@ mkReadBuffer recv = do
-- seem to use it.
connectTls :: ResolvConf -- ^ Resolv conf to use (try 'defaultResolvConf' as a
-- default)
-> TLSParams -- ^ TLS parameters to use when securing the connection
-> ClientParams -- ^ TLS parameters to use when securing the connection
-> String -- ^ Host to use when connecting (will be resolved
-- using SRV records)
-> ErrorT XmppFailure IO StreamHandle
@ -184,9 +184,7 @@ wrapExceptions :: IO a -> IO (Either XmppFailure a) @@ -184,9 +184,7 @@ wrapExceptions :: IO a -> IO (Either XmppFailure a)
wrapExceptions f = Ex.catches (liftM Right $ f)
[ Ex.Handler $ return . Left . XmppIOException
, Ex.Handler $ wrap . XmppTlsError
, Ex.Handler $ wrap . XmppTlsConnectionNotEstablished
, Ex.Handler $ wrap . XmppTlsTerminated
, Ex.Handler $ wrap . XmppTlsHandshakeFailed
, Ex.Handler $ wrap . XmppTlsException
, Ex.Handler $ return . Left
]
where

13
source/Network/Xmpp/Types.hs

@ -544,9 +544,7 @@ data StreamErrorInfo = StreamErrorInfo @@ -544,9 +544,7 @@ data StreamErrorInfo = StreamErrorInfo
} deriving (Show, Eq)
data XmppTlsError = XmppTlsError TLSError
| XmppTlsConnectionNotEstablished ConnectionNotEstablished
| XmppTlsTerminated Terminated
| XmppTlsHandshakeFailed HandshakeFailed
| XmppTlsException TLSException
deriving (Show, Eq, Typeable)
-- | Signals an XMPP stream error or another unpredicted stream-related
@ -1191,16 +1189,19 @@ data StreamConfiguration = @@ -1191,16 +1189,19 @@ data StreamConfiguration =
-- | How the client should behave in regards to TLS.
, tlsBehaviour :: TlsBehaviour
-- | Settings to be used for TLS negotitation
, tlsParams :: TLSParams
, tlsParams :: ClientParams
}
-- | Default parameters for TLS. Those are the default client parameters from the tls package with the ciphers set to ciphersuite_strong
xmppDefaultParams :: Params
xmppDefaultParams = defaultParamsClient{ pCiphers = ciphersuite_strong
xmppDefaultParams :: ClientParams
xmppDefaultParams = (defaultParamsClient "" BS.empty)
{ clientSupported = def
{ supportedCiphers = ciphersuite_strong
++ [ cipher_AES256_SHA1
, cipher_AES128_SHA1
]
}
}
instance Default StreamConfiguration where
def = StreamConfiguration { preferredLang = Nothing

Loading…
Cancel
Save