grim/hgkeeper

Fix the pubkey check

2019-09-12, Gary Kramlich
383331e5a4fb
Parents d13c14d4fadb
Children e2f2ff46f491
Fix the pubkey check
--- a/setup/command.go Thu Sep 12 02:31:11 2019 -0500
+++ b/setup/command.go Thu Sep 12 05:54:15 2019 -0500
@@ -161,7 +161,11 @@
return err
}
- if _, err := ssh.ParsePublicKey(bytes); err != nil {
+ // ssh.ParsePublicKey wants the wire format which includes a size
+ // parameter. However, since every entry of an authorized_key file is
+ // just a straight public key, we can use ParseAuthorizedKey to check if
+ // the file is a public key.
+ if _, _, _, _, err := ssh.ParseAuthorizedKey(bytes); err != nil {
return err
}