go.crypto/ssh: add a error return to decode(), and avoid casting decode() output.
R=dave, kardianos, agl CC=gobot, golang-dev https://golang.org/cl/9738053
This commit is contained in:
committed by
Adam Langley
parent
e8889f5e72
commit
36bf31eb71
+8
-2
@@ -272,7 +272,10 @@ func (p *publickeyAuth) confirmKeyAck(key interface{}, t *transport) (bool, erro
|
||||
case msgUserAuthBanner:
|
||||
// TODO(gpaul): add callback to present the banner to the user
|
||||
case msgUserAuthPubKeyOk:
|
||||
msg := decode(packet).(*userAuthPubKeyOkMsg)
|
||||
msg := userAuthPubKeyOkMsg{}
|
||||
if err := unmarshal(&msg, packet, msgUserAuthPubKeyOk); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if msg.Algo != algoname || msg.PubKey != string(pubkey) {
|
||||
return false, nil
|
||||
}
|
||||
@@ -309,7 +312,10 @@ func handleAuthResponse(t *transport) (bool, []string, error) {
|
||||
case msgUserAuthBanner:
|
||||
// TODO: add callback to present the banner to the user
|
||||
case msgUserAuthFailure:
|
||||
msg := decode(packet).(*userAuthFailureMsg)
|
||||
msg := userAuthFailureMsg{}
|
||||
if err := unmarshal(&msg, packet, msgUserAuthFailure); err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
return false, msg.Methods, nil
|
||||
case msgUserAuthSuccess:
|
||||
return true, nil, nil
|
||||
|
||||
Reference in New Issue
Block a user