Skip to content

Commit

Permalink
Merge pull request #1808 from gravitational/rjones/panic
Browse files Browse the repository at this point in the history
Don't panic on channel failures.
  • Loading branch information
russjones authored Mar 23, 2018
2 parents 0e798fc + 523ad0b commit b53c795
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/srv/forward/sshserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ func (s *Server) handleChannel(ctx *srv.ServerContext, sconn *ssh.ServerConn, nc
case "session":
ch, requests, err := nch.Accept()
if err != nil {
s.log.Infof("Unable to accept channel: %v", err)
s.log.Warnf("Unable to accept channel: %v", err)
nch.Reject(ssh.ConnectionFailed, fmt.Sprintf("unable to accept channel: %v", err))
return
}
go s.handleSessionRequests(ctx, sconn, ch, requests)
// port forwarding
Expand All @@ -504,10 +506,13 @@ func (s *Server) handleChannel(ctx *srv.ServerContext, sconn *ssh.ServerConn, nc
if err != nil {
s.log.Errorf("Failed to parse request data: %v, err: %v", string(nch.ExtraData()), err)
nch.Reject(ssh.UnknownChannelType, "failed to parse direct-tcpip request")
return
}
ch, _, err := nch.Accept()
if err != nil {
s.log.Infof("Unable to accept channel: %v", err)
s.log.Warnf("Unable to accept channel: %v", err)
nch.Reject(ssh.ConnectionFailed, fmt.Sprintf("unable to accept channel: %v", err))
return
}
go s.handleDirectTCPIPRequest(ctx, sconn, ch, req)
default:
Expand Down

0 comments on commit b53c795

Please sign in to comment.