mirror of https://github.com/tp4a/teleport
try to downgrade to libssh 0.8.9.
parent
32ba720ad1
commit
9fa10ea7de
|
@ -231,14 +231,14 @@ class BuilderWin(BuilderBase):
|
||||||
utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
|
utils.unzip(os.path.join(PATH_DOWNLOAD, file_name), PATH_EXTERNAL)
|
||||||
os.rename(os.path.join(PATH_EXTERNAL, 'libssh-{}'.format(env.ver_libssh)), self.LIBSSH_PATH_SRC)
|
os.rename(os.path.join(PATH_EXTERNAL, 'libssh-{}'.format(env.ver_libssh)), self.LIBSSH_PATH_SRC)
|
||||||
|
|
||||||
cc.n('fix libssh source code... ', end='')
|
# cc.n('fix libssh source code... ', end='')
|
||||||
s_name = 'libssh-{}'.format(env.ver_libssh)
|
# s_name = 'libssh-{}'.format(env.ver_libssh)
|
||||||
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
|
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
|
||||||
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
|
# # utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
|
||||||
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
|
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
|
||||||
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
|
# # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
|
||||||
# utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
|
# ## utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
|
||||||
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
|
# # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
|
||||||
|
|
||||||
out_file_lib = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.lib')
|
out_file_lib = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.lib')
|
||||||
out_file_dll = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.dll')
|
out_file_dll = os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path, 'ssh.dll')
|
||||||
|
@ -260,7 +260,7 @@ class BuilderWin(BuilderBase):
|
||||||
|
|
||||||
cc.i('build libssh...')
|
cc.i('build libssh...')
|
||||||
sln_file = os.path.join(self.LIBSSH_PATH_SRC, 'build', 'libssh.sln')
|
sln_file = os.path.join(self.LIBSSH_PATH_SRC, 'build', 'libssh.sln')
|
||||||
utils.msvc_build(sln_file, 'ssh', ctx.target_path, 'win32', False)
|
utils.msvc_build(sln_file, 'ssh_shared', ctx.target_path, 'win32', False)
|
||||||
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.lib'))
|
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.lib'))
|
||||||
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.dll'))
|
utils.ensure_file_exists(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path, 'ssh.dll'))
|
||||||
utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path), os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path), 'ssh.lib')
|
utils.copy_file(os.path.join(self.LIBSSH_PATH_SRC, 'build', 'src', ctx.target_path), os.path.join(self.LIBSSH_PATH_SRC, 'lib', ctx.target_path), 'ssh.lib')
|
||||||
|
@ -516,14 +516,14 @@ class BuilderLinux(BuilderBase):
|
||||||
return
|
return
|
||||||
cc.v('')
|
cc.v('')
|
||||||
|
|
||||||
cc.n('fix libssh source code... ', end='')
|
# cc.n('fix libssh source code... ', end='')
|
||||||
s_name = 'libssh-{}'.format(env.ver_libssh)
|
# s_name = 'libssh-{}'.format(env.ver_libssh)
|
||||||
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
|
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'session.c'))
|
||||||
# utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
|
# ## utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto.c'))
|
||||||
utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
|
# # utils.ensure_file_exists(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src', 'libcrypto-compat.c'))
|
||||||
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
|
# # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'session.c')
|
||||||
# utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
|
# ## utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto.c')
|
||||||
utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
|
# # utils.copy_file(os.path.join(PATH_EXTERNAL, 'fix-external', 'libssh', s_name, 'src'), os.path.join(self.LIBSSH_PATH_SRC, 'src'), 'libcrypto-compat.c')
|
||||||
|
|
||||||
build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')
|
build_path = os.path.join(self.LIBSSH_PATH_SRC, 'build')
|
||||||
|
|
||||||
|
|
|
@ -13,4 +13,4 @@ mongoose = 6.16
|
||||||
; https://www.zlib.net/zlib1211.zip
|
; https://www.zlib.net/zlib1211.zip
|
||||||
zlib = 1.2.11,1211
|
zlib = 1.2.11,1211
|
||||||
; https://git.libssh.org/projects/libssh.git/
|
; https://git.libssh.org/projects/libssh.git/
|
||||||
libssh = 0.9.2
|
libssh = 0.8.9
|
||||||
|
|
|
@ -7,7 +7,7 @@ SshProxy::SshProxy() :
|
||||||
ExThreadBase("ssh-proxy-thread"),
|
ExThreadBase("ssh-proxy-thread"),
|
||||||
m_bind(NULL) {
|
m_bind(NULL) {
|
||||||
m_timer_counter_check_noop = 0;
|
m_timer_counter_check_noop = 0;
|
||||||
m_timer_counter_send_keep_alive= 0;
|
m_timer_counter_keep_alive= 0;
|
||||||
m_noop_timeout_sec = 900; // default to 15 minutes.
|
m_noop_timeout_sec = 900; // default to 15 minutes.
|
||||||
m_listener_running = false;
|
m_listener_running = false;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ bool SshProxy::init() {
|
||||||
void SshProxy::timer() {
|
void SshProxy::timer() {
|
||||||
// timer() will be called per one second
|
// timer() will be called per one second
|
||||||
m_timer_counter_check_noop++;
|
m_timer_counter_check_noop++;
|
||||||
m_timer_counter_send_keep_alive++;
|
m_timer_counter_keep_alive++;
|
||||||
|
|
||||||
// check no-op per 5 seconds.
|
// check no-op per 5 seconds.
|
||||||
if (m_timer_counter_check_noop >= 5) {
|
if (m_timer_counter_check_noop >= 5) {
|
||||||
|
@ -80,12 +80,12 @@ void SshProxy::timer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send keep-alive every 60 seconds
|
// send keep-alive every 60 seconds
|
||||||
if (m_timer_counter_send_keep_alive >= 60) {
|
if (m_timer_counter_keep_alive >= 60) {
|
||||||
m_timer_counter_send_keep_alive = 0;
|
m_timer_counter_keep_alive = 0;
|
||||||
ExThreadSmartLock locker(m_lock);
|
ExThreadSmartLock locker(m_lock);
|
||||||
ts_ssh_sessions::iterator it;
|
ts_ssh_sessions::iterator it;
|
||||||
for (it = m_sessions.begin(); it != m_sessions.end(); ++it) {
|
for (it = m_sessions.begin(); it != m_sessions.end(); ++it) {
|
||||||
it->first->send_keep_alive();
|
it->first->keep_alive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
ssh_bind m_bind;
|
ssh_bind m_bind;
|
||||||
int m_timer_counter_check_noop;
|
int m_timer_counter_check_noop;
|
||||||
int m_timer_counter_send_keep_alive;
|
int m_timer_counter_keep_alive;
|
||||||
|
|
||||||
ExThreadLock m_lock;
|
ExThreadLock m_lock;
|
||||||
bool m_listener_running;
|
bool m_listener_running;
|
||||||
|
|
|
@ -39,6 +39,7 @@ SshSession::SshSession(SshProxy *proxy, ssh_session sess_client) :
|
||||||
|
|
||||||
m_is_logon = false;
|
m_is_logon = false;
|
||||||
m_have_error = false;
|
m_have_error = false;
|
||||||
|
m_need_send_keepalive = false;
|
||||||
m_recving_from_srv = false;
|
m_recving_from_srv = false;
|
||||||
m_recving_from_cli = false;
|
m_recving_from_cli = false;
|
||||||
|
|
||||||
|
@ -323,6 +324,18 @@ void SshSession::_run(void) {
|
||||||
// timeout.
|
// timeout.
|
||||||
_check_channels();
|
_check_channels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_need_send_keepalive) {
|
||||||
|
m_need_send_keepalive = false;
|
||||||
|
EXLOGD("[ssh] send keep-alive.\n");
|
||||||
|
if (m_srv_session)
|
||||||
|
//ssh_send_keepalive(m_srv_session);
|
||||||
|
ssh_send_ignore(m_srv_session, "keepalive@openssh.com");
|
||||||
|
if (m_cli_session)
|
||||||
|
//ssh_send_keepalive(m_cli_session);
|
||||||
|
ssh_send_ignore(m_cli_session, "keepalive@openssh.com");
|
||||||
|
}
|
||||||
|
|
||||||
} while (!m_channels.empty());
|
} while (!m_channels.empty());
|
||||||
|
|
||||||
if (m_channels.empty())
|
if (m_channels.empty())
|
||||||
|
@ -415,12 +428,13 @@ void SshSession::check_noop_timeout(ex_u32 t_now, ex_u32 timeout) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SshSession::send_keep_alive() {
|
void SshSession::keep_alive() {
|
||||||
EXLOGD("[ssh] send keep-alive.\n");
|
m_need_send_keepalive = true;
|
||||||
if(m_srv_session)
|
// EXLOGD("[ssh] keep-alive.\n");
|
||||||
ssh_send_keepalive(m_srv_session);
|
// if(m_srv_session)
|
||||||
if (m_cli_session)
|
// ssh_send_keepalive(m_srv_session);
|
||||||
ssh_send_keepalive(m_cli_session);
|
// if (m_cli_session)
|
||||||
|
// ssh_send_keepalive(m_cli_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public:
|
||||||
void save_record();
|
void save_record();
|
||||||
//
|
//
|
||||||
void check_noop_timeout(ex_u32 t_now, ex_u32 timeout);
|
void check_noop_timeout(ex_u32 t_now, ex_u32 timeout);
|
||||||
void send_keep_alive();
|
void keep_alive();
|
||||||
|
|
||||||
const ex_astr& sid() { return m_sid; }
|
const ex_astr& sid() { return m_sid; }
|
||||||
|
|
||||||
|
@ -146,6 +146,8 @@ private:
|
||||||
|
|
||||||
bool m_have_error;
|
bool m_have_error;
|
||||||
|
|
||||||
|
bool m_need_send_keepalive;
|
||||||
|
|
||||||
bool m_recving_from_srv; // 是否正在从服务器接收数据?
|
bool m_recving_from_srv; // 是否正在从服务器接收数据?
|
||||||
bool m_recving_from_cli; // 是否正在从客户端接收数据?
|
bool m_recving_from_cli; // 是否正在从客户端接收数据?
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue