public PortForwardingCheckResult CheckPortForwardingRequest(string host, int port, string originator_host, int originator_port) { PortForwardingCheckResult r = new PortForwardingCheckResult(); r.allowed = true; r.channel = this; return r; }
public override PortForwardingCheckResult CheckPortForwardingRequest(string remote_host, int remote_port, string originator_ip, int originator_port) { PortForwardingCheckResult r = new PortForwardingCheckResult(); try { if(!_profile.AllowsForeignConnection && originator_ip!="127.0.0.1") { r.allowed = false; r.reason_message = "refused"; return r; } Socket local = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); local.Connect(new IPEndPoint(Util.ResolveHost(_profile.DestinationHost), _profile.DestinationPort)); r.allowed = true; r.channel = new Channel(_profile.SSHHost, originator_ip, _id, null, local); return r; } catch(Exception ex) { Debug.WriteLine(ex.StackTrace); Util.InterThreadWarning(ex.Message); r.allowed = false; r.reason_message = "refused"; return r; } }