Procházet zdrojové kódy

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 před 9 roky
rodič
revize
285fb2ed20
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  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 {
 		t.sessionID = result.H
-		result.SessionID = result.H
 	}
+	result.SessionID = t.sessionID
 
 	t.conn.prepareKeyChange(algs, result)
 	if err = t.conn.writePacket([]byte{msgNewKeys}); err != nil {