fix: handle multiple global requests simultaneously

This commit is contained in:
Ryo Ota 2023-08-11 11:31:35 +09:00
parent 5cc6ad44c6
commit b1973ce4e8

View file

@ -122,6 +122,8 @@ func (s *Server) handleSession(shell string, newChannel ssh.NewChannel) {
}
case "subsystem":
s.handleSessionSubSystem(req, connection)
default:
s.Logger.Info("unknown request", "req_type", req.Type)
}
}
}
@ -312,14 +314,20 @@ func (s *Server) HandleGlobalRequests(sshConn *ssh.ServerConn, reqs <-chan *ssh.
req.Reply(false, nil)
break
}
go func() {
s.handleTcpipForward(sshConn, req)
}()
case "streamlocal-forward@openssh.com":
if !s.AllowStreamlocalForward {
s.Logger.Info("streamlocal-forward not allowed")
req.Reply(false, nil)
break
}
go func() {
s.handleStreamlocalForward(sshConn, req)
}()
// TODO: support cancel-tcpip-forward
// TODO: support cancel-streamlocal-forward@openssh.com
default:
// discard
if req.WantReply {