go.crypto/ssh: add User to ServerConn and pass *ServerConn to callbacks.

R=golang-dev, dave, agl
CC=golang-dev
https://golang.org/cl/5577070
This commit is contained in:
Daniel Theophanes
2012-01-30 15:30:11 -05:00
committed by Adam Langley
parent 470549d502
commit 2b43ac23a9
3 changed files with 14 additions and 7 deletions
+2 -2
View File
@@ -119,10 +119,10 @@ var (
clientKeychain = new(keychain)
clientPassword = password("tiger")
serverConfig = &ServerConfig{
PasswordCallback: func(user, pass string) bool {
PasswordCallback: func(conn *ServerConn, user, pass string) bool {
return user == "testuser" && pass == string(clientPassword)
},
PublicKeyCallback: func(user, algo string, pubkey []byte) bool {
PublicKeyCallback: func(conn *ServerConn, user, algo string, pubkey []byte) bool {
key := clientKeychain.keys[0].(*rsa.PrivateKey).PublicKey
expected := []byte(serializePublickey(key))
algoname := algoName(key)