Beispiel #1
0
        protected override jsch::Session ConnectImpl()
        {
            if (this.gwchain.Count == 0)
            {
                return(null);
            }
            // register identities
            this.m_jsch = new jsch::JSch();
            foreach (SshUserData user in gwchain)
            {
                if (user.useIdentityFile && user.idtt != "")
                {
                    m_jsch.addIdentity(user.idtt, user.psph);
                }
            }

            // logins
            jsch::Session gwsess = null;

            foreach (SshUserData user in gwchain)
            {
                gwsess = create_session(user, gwsess);
            }

            return(gwsess);
        }
Beispiel #2
0
        //--------------------------------------------------------------------------
        //	接続・切断
        //--------------------------------------------------------------------------
        protected override jsch::Session ConnectImpl()
        {
            msg.Write(1, ". Connecting...");
            this.m_jsch = new jsch::JSch();

            if (data.useIdentityFile && data.idtt != "")
            {
                this.m_jsch.addIdentity(data.idtt, data.psph);
            }

            jsch::Session sess = this.m_jsch.getSession(data.user, data.host, data.port);

            sess = this.m_jsch.getSession(data.user, data.host, data.port);
            sess.setConfig(this.config);
            sess.setUserInfo(new SshLoginInfo(this.msg, this.data));
            sess.setPassword(data.pass);
            sess.connect();
            this.resources.Add(sess);

            msg.Write(1, ". Connected");
            return(sess);
        }
Beispiel #3
0
 protected override void DisconnectImpl()
 {
     this.m_jsch = null;
 }