Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2203)

Unified Diff: ssh/client_auth_test.go

Issue 35110043: code review 35110043: gosshnew/ssh: Pubkey client auth now should return []Signer. (Closed)
Patch Set: diff -r 14ed64f25713 https://hanwen%40google.com@code.google.com/p/gosshnew/ Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ssh/client_auth.go ('k') | ssh/test/test_unix_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ssh/client_auth_test.go
===================================================================
--- a/ssh/client_auth_test.go
+++ b/ssh/client_auth_test.go
@@ -7,7 +7,6 @@
import (
"bytes"
"crypto/dsa"
- "io"
"io/ioutil"
"math/big"
"strings"
@@ -60,16 +59,8 @@
keys []Signer
}
-func (k *keychain) Key(i int) (PublicKey, error) {
- if i < 0 || i >= len(k.keys) {
- return nil, nil
- }
-
- return k.keys[i].PublicKey(), nil
-}
-
-func (k *keychain) Sign(i int, rand io.Reader, data []byte) (sig []byte, err error) {
- return k.keys[i].Sign(rand, data)
+func (k *keychain) Signers() ([]Signer, error) {
+ return k.keys, nil
}
func (k *keychain) add(key Signer) {
@@ -117,7 +108,11 @@
return conn.User() == "testuser" && string(pass) == string(clientPassword)
},
PublicKeyCallback: func(conn ConnMetadata, algo string, pubkey []byte) bool {
- key, _ := clientKeychain.Key(0)
+ ids, err := clientKeychain.Signers()
+ if err != nil {
+ return false
+ }
+ key := ids[0].PublicKey()
expected := MarshalPublicKey(key)
algoname := key.PublicKeyAlgo()
return conn.User() == "testuser" && algo == algoname && bytes.Equal(pubkey, expected)
« no previous file with comments | « ssh/client_auth.go ('k') | ssh/test/test_unix_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b