aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Pairing.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-02-09 16:34:57 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-02-09 16:34:57 -0400
commitdf60c8197975496605b375ce93d3607dc843fe37 (patch)
tree270958a3c5621ed04f824e05f9cf438df1ee51d4 /Assistant/Pairing.hs
parent8d34737ac0693bb448f016f195d5082dc8e6d3df (diff)
assistant: Improve sanity check for control characters when pairing.
Diffstat (limited to 'Assistant/Pairing.hs')
-rw-r--r--Assistant/Pairing.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Assistant/Pairing.hs b/Assistant/Pairing.hs
index 492b98592..b24e5fdb6 100644
--- a/Assistant/Pairing.hs
+++ b/Assistant/Pairing.hs
@@ -58,6 +58,15 @@ data PairData = PairData
}
deriving (Eq, Read, Show)
+checkSane :: PairData -> Bool
+checkSane p = all (not . any isControl)
+ [ fromMaybe "" (remoteHostName p)
+ , remoteUserName p
+ , remoteDirectory p
+ , remoteSshPubKey p
+ , fromUUID (pairUUID p)
+ ]
+
type UserName = String
{- A pairing that is in progress has a secret, a thread that is