Explorar el Código

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 hace 9 años
padre
commit
285fb2ed20
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  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 {