aboutsummaryrefslogtreecommitdiff
path: root/ssh/server.go
diff options
context:
space:
mode:
authorMatt Dainty <matt@bodgit-n-scarper.com>2021-01-25 10:36:18 +0000
committerGopher Robot <gobot@golang.org>2023-11-11 11:26:14 +0000
commit1cf1811d7195fe9bb436a00e335567575fac9b07 (patch)
tree1176771d03557aeff669c71d5b36c2623a24bb0e /ssh/server.go
parenta2edfb50727c2b04a93ccc2f0f7931a02fb623d7 (diff)
downloadgo-x-crypto-1cf1811d7195fe9bb436a00e335567575fac9b07.tar.xz
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: 0d58e4d50014fac0a9ea1eef85489172137eb8aa GitHub-Pull-Request: golang/crypto#176 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/286252 Run-TryBot: Filippo Valsorda <filippo@golang.org> Auto-Submit: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Nicola Murino <nicola.murino@gmail.com> Reviewed-by: Nicola Murino <nicola.murino@gmail.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'ssh/server.go')
-rw-r--r--ssh/server.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/ssh/server.go b/ssh/server.go
index 8f1505a..7f0c236 100644
--- a/ssh/server.go
+++ b/ssh/server.go
@@ -337,7 +337,7 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error {
return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)
}
-func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *connection,
+func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, token []byte, s *connection,
sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) {
gssAPIServer := gssapiConfig.Server
defer gssAPIServer.DeleteSecContext()
@@ -347,7 +347,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c
outToken []byte
needContinue bool
)
- outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(firstToken)
+ outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(token)
if err != nil {
return err, nil, nil
}
@@ -369,6 +369,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c
if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {
return nil, nil, err
}
+ token = userAuthGSSAPITokenReq.Token
}
packet, err := s.transport.readPacket()
if err != nil {