Example #1
0
        private static SSHConnection ConnectMain(SSHConnectionParameter param, ISSHConnectionEventReceiver receiver, VersionExchangeHandler pnh, AbstractGranadosSocket s) {
            DataFragment data = pnh.WaitResponse();
            string sv = pnh.ServerVersion;

            SSHConnection con = null;
            if (param.Protocol == SSHProtocol.SSH1)
                throw new SSHException("SSH1 is not supported");
            else
                con = new SSH2Connection(param, s, receiver, sv, SSHUtil.ClientVersionString(param.Protocol));

            con.TraceReceptionEvent("server version-string", sv.Trim());
            pnh.Close();
            s.SetHandler(con.PacketBuilder);
            con.SendMyVersion(param);

            if (con.Connect() != AuthenticationResult.Failure) {
                return con;
            }
            else {
                s.Close();
                return null;
            }
        }
Example #2
0
 //attach to an existing channel
 public SSH2Channel(SSH2Connection con, ChannelType type, int local_id, int remote_id, int maxpacketsize)
     : base(con, type, local_id) 
 {
     _connection = con;
     _windowSize = _leftWindowSize = con.Param.WindowSize;
     Debug.Assert(type == ChannelType.ForwardedRemoteToLocal || type == ChannelType.AgentForward);
     _remoteID = remote_id;
     _serverMaxPacketSize = maxpacketsize;
     _negotiationStatus = NegotiationStatus.Ready;
 }
Example #3
0
 public KeyExchanger(SSH2Connection con, byte[] sessionID) {
     _connection = con;
     _param = con.Param;
     _cInfo = (SSH2ConnectionInfo)con.ConnectionInfo;
     _sessionID = sessionID;
     _status = Status.INITIAL;
     _packet = new SSH2TransmissionPacket();
 }
Example #4
0
 public SSH2Channel(SSH2Connection con, ChannelType type, int local_id, string command)
     : base(con, type, local_id) 
 {
     _command = command;
     if (type == ChannelType.ExecCommand || type == ChannelType.Subsystem)
         Debug.Assert(command != null); //'command' is required for ChannelType.ExecCommand
     _connection = con;
     _windowSize = _leftWindowSize = con.Param.WindowSize;
     _negotiationStatus = NegotiationStatus.WaitingChannelConfirmation;
 }
Example #5
0
 internal CallbackSSH2PacketHandler(SSH2Connection con) {
     _connection = con;
 }