Jelajahi Sumber

x/crypto/ssh: debug support for msgUserAuthSuccess and msgChannelData

Change-Id: I14d59509f22edf01827610a4ef4c50b53cbc8059
Reviewed-on: https://go-review.googlesource.com/21605
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Han-Wen Nienhuys 9 tahun lalu
induk
melakukan
2f6fccd33b
1 mengubah file dengan 15 tambahan dan 0 penghapusan
  1. 15 0
      ssh/messages.go

+ 15 - 0
ssh/messages.go

@@ -124,6 +124,10 @@ type userAuthRequestMsg struct {
 	Payload []byte `ssh:"rest"`
 	Payload []byte `ssh:"rest"`
 }
 }
 
 
+// Used for debug printouts of packets.
+type userAuthSuccessMsg struct {
+}
+
 // See RFC 4252, section 5.1
 // See RFC 4252, section 5.1
 const msgUserAuthFailure = 51
 const msgUserAuthFailure = 51
 
 
@@ -158,6 +162,13 @@ type channelOpenMsg struct {
 const msgChannelExtendedData = 95
 const msgChannelExtendedData = 95
 const msgChannelData = 94
 const msgChannelData = 94
 
 
+// Used for debug print outs of packets.
+type channelDataMsg struct {
+	PeersId uint32 `sshtype:"94"`
+	Length  uint32
+	Rest    []byte `ssh:"rest"`
+}
+
 // See RFC 4254, section 5.1.
 // See RFC 4254, section 5.1.
 const msgChannelOpenConfirm = 91
 const msgChannelOpenConfirm = 91
 
 
@@ -687,6 +698,8 @@ func decode(packet []byte) (interface{}, error) {
 		msg = new(kexDHReplyMsg)
 		msg = new(kexDHReplyMsg)
 	case msgUserAuthRequest:
 	case msgUserAuthRequest:
 		msg = new(userAuthRequestMsg)
 		msg = new(userAuthRequestMsg)
+	case msgUserAuthSuccess:
+		return new(userAuthSuccessMsg), nil
 	case msgUserAuthFailure:
 	case msgUserAuthFailure:
 		msg = new(userAuthFailureMsg)
 		msg = new(userAuthFailureMsg)
 	case msgUserAuthPubKeyOk:
 	case msgUserAuthPubKeyOk:
@@ -699,6 +712,8 @@ func decode(packet []byte) (interface{}, error) {
 		msg = new(globalRequestFailureMsg)
 		msg = new(globalRequestFailureMsg)
 	case msgChannelOpen:
 	case msgChannelOpen:
 		msg = new(channelOpenMsg)
 		msg = new(channelOpenMsg)
+	case msgChannelData:
+		msg = new(channelDataMsg)
 	case msgChannelOpenConfirm:
 	case msgChannelOpenConfirm:
 		msg = new(channelOpenConfirmMsg)
 		msg = new(channelOpenConfirmMsg)
 	case msgChannelOpenFailure:
 	case msgChannelOpenFailure: