summaryrefslogtreecommitdiffhomepage
path: root/keysafe.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2016-09-27 20:22:53 -0400
committerJoey Hess <joeyh@joeyh.name>2016-09-27 20:24:31 -0400
commit758965d177d75f529bb88e24564a0bdb5e406fc6 (patch)
tree8632125811610fb7444784d10caf6441dcf792e7 /keysafe.hs
parent40ef6d76d4d50c48f103c2b94cd45c7647a25dbc (diff)
downloadkeysafe-758965d177d75f529bb88e24564a0bdb5e406fc6.tar.gz
Filter out escape sequences and any other unusual characters when writing all messages to the console.
This should protect against all attacks where the server sends back a malicious message.
Diffstat (limited to 'keysafe.hs')
-rw-r--r--keysafe.hs18
1 files changed, 9 insertions, 9 deletions
diff --git a/keysafe.hs b/keysafe.hs
index d27f87a..bd63ff1 100644
--- a/keysafe.hs
+++ b/keysafe.hs
@@ -11,6 +11,7 @@ import Types
import Tunables
import qualified CmdLine
import UI
+import Output
import Encryption
import Entropy
import Benchmark
@@ -40,7 +41,6 @@ import qualified Data.Text as T
import qualified Data.ByteString as B
import qualified Data.ByteString.UTF8 as BU8
import qualified Data.Set as S
-import System.IO
import System.Posix.User (userGecos, getUserEntryForID, getEffectiveUserID)
main :: IO ()
@@ -411,9 +411,9 @@ autoStart cmdline tunables ui = do
checkServers :: IO ()
checkServers = do
- putStrLn $ "Checking " ++ show (length networkServers) ++ " servers concurrently; please wait..."
+ say $ "Checking " ++ show (length networkServers) ++ " servers concurrently; please wait..."
results <- mapConcurrently check networkServers
- mapM_ display results
+ mapM_ displayresult results
case filter failed results of
[] -> return ()
l
@@ -433,14 +433,14 @@ checkServers = do
(_, Left e) -> return (s, Left e)
(_, Right (CountFailure e)) -> return (s, Left e)
- display (s, v) = do
- putStrLn $ "* " ++ sn s ++ " -- " ++ serverDesc s
+ displayresult (s, v) = do
+ say $ "* " ++ sn s ++ " -- " ++ serverDesc s
case v of
Right (mt, cr) -> do
- putStrLn $ " MOTD: " ++ T.unpack mt
- putStrLn $ " object count: " ++ show cr
- Left e -> hPutStrLn stderr $
- " failed to get connect to " ++ sn s ++ ": " ++ e
+ say $ " MOTD: " ++ T.unpack mt
+ say $ " object count: " ++ show cr
+ Left e -> warn $
+ " failed to connect to " ++ sn s ++ ": " ++ e
failed (_, Left _) = True
failed _ = False