Skip to content

Commit

Permalink
fix: handle channel accept failures in similar fashion
Browse files Browse the repository at this point in the history
  • Loading branch information
rosstimothy committed Jul 27, 2022
1 parent a35a1fb commit 17b9193
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 61 deletions.
5 changes: 3 additions & 2 deletions lib/srv/forward/sshserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,9 @@ func (s *Server) handleChannel(ctx context.Context, nch ssh.NewChannel) {
case tracessh.TracingChannel:
ch, _, err := nch.Accept()
if err != nil {
if err := nch.Reject(ssh.ConnectionFailed, err.Error()); err != nil {
s.log.Warnf("Unable to reject %q channel: %v", nch.ChannelType(), err)
s.log.Warnf("Unable to accept channel: %v", err)
if err := nch.Reject(ssh.ConnectionFailed, fmt.Sprintf("unable to accept channel: %v", err)); err != nil {
s.log.Warnf("Failed to reject channel: %v", err)
}
return
}
Expand Down
Loading

0 comments on commit 17b9193

Please sign in to comment.