Skip to content
This repository was archived by the owner on Apr 7, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion GitCandy/Ssh/Services/ConnectionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ private void HandleMessage(ChannelOpenMessage message)
}
}

private bool IsRequestTypeTolerated(ChannelRequestMessage message)
{
if (message == null)
return (false);

switch (message.RequestType)
{
// Occured on Ubuntu -> "SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2"
case "env":
return (true);
default:
return (false);
}
}

private void HandleMessage(ChannelRequestMessage message)
{
switch (message.RequestType)
Expand All @@ -75,7 +90,11 @@ private void HandleMessage(ChannelRequestMessage message)
{
RecipientChannel = FindChannelByServerId<Channel>(message.RecipientChannel).ClientChannelId
});
throw new SshConnectionException(string.Format("Unknown request type: {0}.", message.RequestType));

if (!IsRequestTypeTolerated(message))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your coding and sorry for deferred reply!
Here, could you please print message.RawBytes to show what the package actually is. To help me understanding the mechanism.

throw new SshConnectionException(string.Format("Unknown request type: {0}.", message.RequestType));

break;
}
}

Expand Down