Skip to content

Commit 1cf1811

Browse files
bodgitgopherbot
authored andcommitted
ssh: use the correct token from the client
This fixes the case where AcceptSecContext is always called with the first token sent by the client instead of the most recently sent one. Previously, despite being being read from the client and unmarshalled, it was never actually used. Fixes golang/go#43875 Change-Id: I1967d9a107af03d6778a9437b48e785d61710ee5 GitHub-Last-Rev: 0d58e4d GitHub-Pull-Request: #176 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/286252 Run-TryBot: Filippo Valsorda <[email protected]> Auto-Submit: Filippo Valsorda <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Run-TryBot: Nicola Murino <[email protected]> Reviewed-by: Nicola Murino <[email protected]> Reviewed-by: Filippo Valsorda <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent a2edfb5 commit 1cf1811

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ssh/server.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error {
337337
return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)
338338
}
339339

340-
func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *connection,
340+
func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, token []byte, s *connection,
341341
sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) {
342342
gssAPIServer := gssapiConfig.Server
343343
defer gssAPIServer.DeleteSecContext()
@@ -347,7 +347,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c
347347
outToken []byte
348348
needContinue bool
349349
)
350-
outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(firstToken)
350+
outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(token)
351351
if err != nil {
352352
return err, nil, nil
353353
}
@@ -369,6 +369,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c
369369
if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
370370
return nil, nil, err
371371
}
372+
token = userAuthGSSAPITokenReq.Token
372373
}
373374
packet, err := s.transport.readPacket()
374375
if err != nil {

0 commit comments

Comments
 (0)