From 0b06b56c0ef22dba2c378552664a1193b9a1aa50 Mon Sep 17 00:00:00 2001 From: Andrey Petrov Date: Fri, 15 Mar 2019 18:30:21 -0400 Subject: [PATCH] main: --admin and --whitelist: Skip non-key lines Closes #298 --- cmd/ssh-chat/cmd.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/ssh-chat/cmd.go b/cmd/ssh-chat/cmd.go index 218cfcd..ac7639a 100644 --- a/cmd/ssh-chat/cmd.go +++ b/cmd/ssh-chat/cmd.go @@ -126,6 +126,9 @@ func main() { err = fromFile(options.Admin, func(line []byte) error { key, _, _, _, err := ssh.ParseAuthorizedKey(line) if err != nil { + if err.Error() == "ssh: no key found" { + return nil // Skip line + } return err } auth.Op(key, 0) @@ -138,6 +141,9 @@ func main() { err = fromFile(options.Whitelist, func(line []byte) error { key, _, _, _, err := ssh.ParseAuthorizedKey(line) if err != nil { + if err.Error() == "ssh: no key found" { + return nil // Skip line + } return err } auth.Whitelist(key, 0)