main: --admin and --whitelist: Skip non-key lines

Closes #298
This commit is contained in:
Andrey Petrov 2019-03-15 18:30:21 -04:00
parent 60701198fc
commit 0b06b56c0e
1 changed files with 6 additions and 0 deletions

View File

@ -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)