瀏覽代碼

x/crypto/ssh: fix subsequent key exchanges.

In https://go-review.googlesource.com/#/c/21606/ , kexResult.SessionID
was erroneously not set for all but the first key exchange. The
unittests did not catch this, as server and client make the same
mistake, but OpenSSH notices corrupted data and kills the connection.

Fixes #15445.

Change-Id: If98249b37d81efaa2ebefc836df0b150feba1256
Reviewed-on: https://go-review.googlesource.com/22418
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Han-Wen Nienhuys 9 年之前
父節點
當前提交
285fb2ed20
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      ssh/handshake.go

+ 1 - 1
ssh/handshake.go

@@ -370,8 +370,8 @@ func (t *handshakeTransport) enterKeyExchangeLocked(otherInitPacket []byte) erro
 
 
 	if t.sessionID == nil {
 	if t.sessionID == nil {
 		t.sessionID = result.H
 		t.sessionID = result.H
-		result.SessionID = result.H
 	}
 	}
+	result.SessionID = t.sessionID
 
 
 	t.conn.prepareKeyChange(algs, result)
 	t.conn.prepareKeyChange(algs, result)
 	if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {
 	if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {