go.crypto/ssh: fix panic unmarshalling channelOpenFailureMsg

I introduced this problem in change set 33 when I redefined
RejectionReason from a uint32 to an int. I have added a test
to verify the message can be marshaled correctly.

This was a bit hard to track down as the recover in clientConn
mainLoop would catch the panic and shutdown the connection. We
probably shouldn't be using panic inside marshal/unmarshal, at
least not without a way to let the user know why the recover
logic tripped.

R=agl, kardianos, gustav.paul
CC=golang-dev
https://golang.org/cl/6210063
This commit is contained in:
Dave Cheney
2012-05-18 09:11:31 +10:00
parent e6ded17971
commit 36d74d6fed
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ func (c ChannelRequest) Error() string {
// RejectionReason is an enumeration used when rejecting channel creation
// requests. See RFC 4254, section 5.1.
type RejectionReason int
type RejectionReason uint32
const (
Prohibited RejectionReason = iota + 1