( authenticatedMetadata metadata.ConnectionAuthenticatedMetadata, channels <-chan ssh.NewChannel, connection SSHConnectionHandler, logger log.Logger, )
| 782 | } |
| 783 | |
| 784 | func (s *serverImpl) handleChannels( |
| 785 | authenticatedMetadata metadata.ConnectionAuthenticatedMetadata, |
| 786 | channels <-chan ssh.NewChannel, |
| 787 | connection SSHConnectionHandler, |
| 788 | logger log.Logger, |
| 789 | ) { |
| 790 | for { |
| 791 | newChannel, ok := <-channels |
| 792 | if !ok { |
| 793 | break |
| 794 | } |
| 795 | s.lock.Lock() |
| 796 | channelID := s.nextChannelID |
| 797 | s.nextChannelID++ |
| 798 | s.lock.Unlock() |
| 799 | logger = logger.WithLabel("channelId", channelID) |
| 800 | switch newChannel.ChannelType() { |
| 801 | case ChannelTypeSession: |
| 802 | go s.handleSessionChannel(authenticatedMetadata.Channel(channelID), newChannel, connection, logger) |
| 803 | case ChannelTypeDirectTCPIP: |
| 804 | go s.handleDirectForwardingChannel(authenticatedMetadata.Channel(channelID), newChannel, connection, logger) |
| 805 | case ChannelTypeDirectStreamLocal: |
| 806 | go s.handleDirectStreamLocalChannel(authenticatedMetadata.Channel(channelID), newChannel, connection, logger) |
| 807 | default: |
| 808 | logger.Debug( |
| 809 | messageCodes.NewMessage( |
| 810 | messageCodes.ESSHUnsupportedChannelType, |
| 811 | "Unsupported channel type requested", |
| 812 | ).Label("type", newChannel.ChannelType()), |
| 813 | ) |
| 814 | connection.OnUnsupportedChannel(channelID, newChannel.ChannelType(), newChannel.ExtraData()) |
| 815 | if err := newChannel.Reject(ssh.UnknownChannelType, "unsupported channel type"); err != nil { |
| 816 | logger.Debug("failed to send channel rejection for channel type %s", newChannel.ChannelType()) |
| 817 | } |
| 818 | continue |
| 819 | } |
| 820 | } |
| 821 | } |
| 822 | |
| 823 | func (s *serverImpl) handleSessionChannel( |
| 824 | channelMetadata metadata.ChannelMetadata, |
no test coverage detected