diff options
author | 2012-09-13 00:57:52 -0400 | |
---|---|---|
committer | 2012-09-13 00:57:52 -0400 | |
commit | df337bb63b4ed6e5d2ce563ec89d28d192e791db (patch) | |
tree | 638813a415727b8a5441ba450e20e6dc2632c970 /Assistant/Threads/PairListener.hs | |
parent | a3913f52e52777b18bd8e50ff593a4f4085e8b93 (diff) |
hlint
Diffstat (limited to 'Assistant/Threads/PairListener.hs')
-rw-r--r-- | Assistant/Threads/PairListener.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Assistant/Threads/PairListener.hs b/Assistant/Threads/PairListener.hs index 746d88a96..9ce369032 100644 --- a/Assistant/Threads/PairListener.hs +++ b/Assistant/Threads/PairListener.hs @@ -50,7 +50,7 @@ pairListenerThread st dstatus scanremotes urlrenderer = thread $ withSocketsDo $ else do pairReqReceived verified dstatus urlrenderer m go sock (m:take 10 reqs) (invalidateCache m cache) - (_, _, PairAck) -> do + (_, _, PairAck) -> pairAckReceived verified pip st dstatus scanremotes m cache >>= go sock reqs (_, _, PairDone) -> do @@ -65,8 +65,8 @@ pairListenerThread st dstatus scanremotes urlrenderer = thread $ withSocketsDo $ -} verificationCheck m (Just pip) = do let verified = verifiedPairMsg m pip - let sameuuid = pairUUID (inProgressPairData pip) == pairUUID (pairMsgData $ m) - if (not verified && sameuuid) + let sameuuid = pairUUID (inProgressPairData pip) == pairUUID (pairMsgData m) + if not verified && sameuuid then do runThreadState st $ warning "detected possible pairing brute force attempt; disabled pairing" @@ -88,8 +88,7 @@ pairListenerThread st dstatus scanremotes urlrenderer = thread $ withSocketsDo $ {- PairReqs invalidate the cache of recently finished pairings. - This is so that, if a new pairing is started with the - same secret used before, a bogus PairDone is not sent. -} - invalidateCache msg = - filter (\pip -> not $ verifiedPairMsg msg pip) + invalidateCache msg = filter (not . verifiedPairMsg msg) getmsg sock c = do (msg, n, _) <- recvFrom sock chunksz @@ -124,7 +123,7 @@ pairAckReceived True (Just pip) st dstatus scanremotes msg cache = do finishedPairing st dstatus scanremotes msg (inProgressSshKeyPair pip) startSending dstatus pip PairDone $ multicastPairMsg (Just 1) (inProgressSecret pip) (inProgressPairData pip) - return $ pip:(take 10 cache) + return $ pip : take 10 cache {- A stale PairAck might also be seen, after we've finished pairing. - Perhaps our PairDone was not received. To handle this, we keep - a cache of recently finished pairings, and re-send PairDone in |