ssh: use *rsa.PublicKey or *dsa.PublicKey in interfaces.
Everywhere else in the code base, when we have an interface{} which is
a stand in for a public key, we use *foo.PublicKey rather than
foo.PublicKey. This change makes ssh reflect that.
R=dave, r
CC=golang-dev
https://golang.org/cl/5686067
This commit is contained in:
@@ -69,9 +69,9 @@ func (k *keychain) Key(i int) (interface{}, error) {
|
||||
}
|
||||
switch key := k.keys[i].(type) {
|
||||
case *rsa.PrivateKey:
|
||||
return key.PublicKey, nil
|
||||
return &key.PublicKey, nil
|
||||
case *dsa.PrivateKey:
|
||||
return key.PublicKey, nil
|
||||
return &key.PublicKey, nil
|
||||
}
|
||||
panic("unknown key type")
|
||||
}
|
||||
@@ -123,7 +123,7 @@ var (
|
||||
return user == "testuser" && pass == string(clientPassword)
|
||||
},
|
||||
PublicKeyCallback: func(conn *ServerConn, user, algo string, pubkey []byte) bool {
|
||||
key := clientKeychain.keys[0].(*rsa.PrivateKey).PublicKey
|
||||
key := &clientKeychain.keys[0].(*rsa.PrivateKey).PublicKey
|
||||
expected := []byte(serializePublickey(key))
|
||||
algoname := algoName(key)
|
||||
return user == "testuser" && algo == algoname && bytes.Equal(pubkey, expected)
|
||||
|
||||
Reference in New Issue
Block a user