Commit fc6df2fd authored by Dave Cheney's avatar Dave Cheney Committed by Adam Langley

exp/ssh: rename ClientAuthPublicKey helper ClientAuthKeyring

Also, rename ServerConfig.PubKeyCallback to PublicKeyCallback.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5477059
parent 17264df1
......@@ -283,8 +283,8 @@ func (p *publickeyAuth) method() string {
return "publickey"
}
// ClientAuthPublickey returns a ClientAuth using public key authentication.
func ClientAuthPublickey(impl ClientKeyring) ClientAuth {
// ClientAuthKeyring returns a ClientAuth using public key authentication.
func ClientAuthKeyring(impl ClientKeyring) ClientAuth {
return &publickeyAuth{impl}
}
......
......@@ -122,7 +122,7 @@ var (
PasswordCallback: func(user, pass string) bool {
return user == "testuser" && pass == string(clientPassword)
},
PubKeyCallback: func(user, algo string, pubkey []byte) bool {
PublicKeyCallback: func(user, algo string, pubkey []byte) bool {
key := clientKeychain.keys[0].(*rsa.PrivateKey).PublicKey
expected := []byte(serializePublickey(key))
algoname := algoName(key)
......@@ -179,7 +179,7 @@ func TestClientAuthPublickey(t *testing.T) {
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
ClientAuthPublickey(clientKeychain),
ClientAuthKeyring(clientKeychain),
},
}
c, err := Dial("tcp", newMockAuthServer(t), config)
......@@ -210,7 +210,7 @@ func TestClientAuthWrongPassword(t *testing.T) {
User: "testuser",
Auth: []ClientAuth{
ClientAuthPassword(wrongPw),
ClientAuthPublickey(clientKeychain),
ClientAuthKeyring(clientKeychain),
},
}
......@@ -228,7 +228,7 @@ func TestClientAuthInvalidPublickey(t *testing.T) {
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
ClientAuthPublickey(kc),
ClientAuthKeyring(kc),
},
}
......@@ -246,7 +246,7 @@ func TestClientAuthRSAandDSA(t *testing.T) {
config := &ClientConfig{
User: "testuser",
Auth: []ClientAuth{
ClientAuthPublickey(kc),
ClientAuthKeyring(kc),
},
}
c, err := Dial("tcp", newMockAuthServer(t), config)
......
......@@ -50,7 +50,7 @@ func TestFuncPublickeyAuth(t *testing.T) {
config := &ClientConfig{
User: *sshuser,
Auth: []ClientAuth{
ClientAuthPublickey(kc),
ClientAuthKeyring(kc),
},
}
conn, err := Dial("tcp", "localhost:22", config)
......
......@@ -36,10 +36,10 @@ type ServerConfig struct {
// several goroutines.
PasswordCallback func(user, password string) bool
// PubKeyCallback, if non-nil, is called when a client attempts public
// PublicKeyCallback, if non-nil, is called when a client attempts public
// key authentication. It must return true iff the given public key is
// valid for the given user.
PubKeyCallback func(user, algo string, pubkey []byte) bool
PublicKeyCallback func(user, algo string, pubkey []byte) bool
// Cryptographic-related configuration.
Crypto CryptoConfig
......@@ -359,7 +359,7 @@ func isAcceptableAlgo(algo string) bool {
// testPubKey returns true if the given public key is acceptable for the user.
func (s *ServerConn) testPubKey(user, algo string, pubKey []byte) bool {
if s.config.PubKeyCallback == nil || !isAcceptableAlgo(algo) {
if s.config.PublicKeyCallback == nil || !isAcceptableAlgo(algo) {
return false
}
......@@ -369,7 +369,7 @@ func (s *ServerConn) testPubKey(user, algo string, pubKey []byte) bool {
}
}
result := s.config.PubKeyCallback(user, algo, pubKey)
result := s.config.PublicKeyCallback(user, algo, pubKey)
if len(s.cachedPubKeys) < maxCachedPubKeys {
c := cachedPubKey{
user: user,
......@@ -425,7 +425,7 @@ userAuthLoop:
break userAuthLoop
}
case "publickey":
if s.config.PubKeyCallback == nil {
if s.config.PublicKeyCallback == nil {
break
}
payload := userAuthReq.Payload
......@@ -499,7 +499,7 @@ userAuthLoop:
if s.config.PasswordCallback != nil {
failureMsg.Methods = append(failureMsg.Methods, "password")
}
if s.config.PubKeyCallback != nil {
if s.config.PublicKeyCallback != nil {
failureMsg.Methods = append(failureMsg.Methods, "publickey")
}
......
......@@ -20,7 +20,7 @@ func dial(handler serverType, t *testing.T) *ClientConn {
serverConfig.PasswordCallback = func(user, pass string) bool {
return user == "testuser" && pass == string(pw)
}
serverConfig.PubKeyCallback = nil
serverConfig.PublicKeyCallback = nil
l, err := Listen("tcp", "127.0.0.1:0", serverConfig)
if err != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment