diff options
author | Joey Hess <joey@kitenet.net> | 2013-06-10 23:54:28 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-06-10 23:55:54 -0400 |
commit | 3e8bef013d781f3b3f549c5b4b74c497f8b71394 (patch) | |
tree | e747cc2c9e7e847030636849018a18e9e264b712 /Assistant | |
parent | 924b776dfd494da45ce2274a7080b4e548cdfd11 (diff) |
display any illegal character found in ssh comment
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/Ssh.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Assistant/Ssh.hs b/Assistant/Ssh.hs index 7875c4c4c..182e85377 100644 --- a/Assistant/Ssh.hs +++ b/Assistant/Ssh.hs @@ -82,9 +82,10 @@ validateSshPubKey pubkey = either error return $ check $ words pubkey where (ssh, keytype) = separate (== '-') prefix - checkcomment comment - | all (\c -> isAlphaNum c || c == '@' || c == '-' || c == '_' || c == '.') comment = ok - | otherwise = err "bad comment in ssh public key" + checkcomment comment = case filter (not . safeincomment) comment of + [] -> ok + badstuff -> err $ "bad comment in ssh public key (contains: \"" ++ badstuff ++ "\")" + safeincomment c = isAlphaNum c || c == '@' || c == '-' || c == '_' || c == '.' addAuthorizedKeys :: Bool -> FilePath -> SshPubKey -> IO Bool addAuthorizedKeys rsynconly dir pubkey = boolSystem "sh" |