mirror of https://github.com/tp4a/teleport
temp.
parent
c0bfcd2226
commit
4ca0d58f1d
|
@ -173,6 +173,7 @@
|
|||
|
||||
/* Define to 1 if you want to enable SSH1 */
|
||||
/* #undef WITH_SSH1 */
|
||||
#define WITH_SSH1
|
||||
|
||||
/* Define to 1 if you want to enable server support */
|
||||
#define WITH_SERVER 1
|
||||
|
|
|
@ -213,6 +213,9 @@
|
|||
<ClCompile Include="src\threads\pthread.c" />
|
||||
<ClCompile Include="src\wrapper.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\config.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
|
|
@ -205,4 +205,9 @@
|
|||
<Filter>Source Files\threads</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -86,6 +86,8 @@ void SshProxy::_thread_loop()
|
|||
{
|
||||
// 注意,ssh_new()出来的指针,如果遇到停止标志,本函数内部就释放了,否则这个指针交给了SshSession类实例管理,其析构时会释放。
|
||||
ssh_session sess_to_client = ssh_new();
|
||||
int verbosity = 4;
|
||||
ssh_options_set(sess_to_client, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
|
||||
ssh_set_blocking(sess_to_client, 1);
|
||||
|
||||
struct sockaddr_storage sock_client;
|
||||
|
|
|
@ -348,6 +348,8 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
|
|||
// 现在尝试根据session-id获取得到的信息,连接并登录真正的SSH服务器
|
||||
EXLOGV("[ssh] try to connect to real SSH server %s:%d\n", _this->m_conn_ip.c_str(), _this->m_conn_port);
|
||||
_this->m_srv_session = ssh_new();
|
||||
int verbosity = 4;
|
||||
ssh_options_set(_this->m_srv_session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
|
||||
ssh_set_blocking(_this->m_srv_session, 1);
|
||||
ssh_options_set(_this->m_srv_session, SSH_OPTIONS_HOST, _this->m_conn_ip.c_str());
|
||||
int port = (int)_this->m_conn_port;
|
||||
|
@ -596,7 +598,7 @@ int SshSession::_on_client_shell_request(ssh_session session, ssh_channel channe
|
|||
cp->type = TS_SSH_CHANNEL_TYPE_SHELL;
|
||||
g_ssh_env.session_update(cp->db_id, TP_PROTOCOL_TYPE_SSH_SHELL, TP_SESS_STAT_STARTED);
|
||||
|
||||
// FIXME: if client is putty, it will block here. the following function will never return.
|
||||
// FIXME: sometimes it will block here. the following function will never return.
|
||||
// at this time, can not write data to this channel. read from this channel with timeout, got 0 byte.
|
||||
// I have no idea how to fix it... :(
|
||||
int err = ssh_channel_request_shell(cp->srv_channel);
|
||||
|
@ -630,7 +632,7 @@ void SshSession::_on_client_channel_close(ssh_session session, ssh_channel chann
|
|||
|
||||
int SshSession::_on_client_channel_data(ssh_session session, ssh_channel channel, void *data, unsigned int len, int is_stderr, void *userdata)
|
||||
{
|
||||
//EXLOG_BIN((ex_u8*)data, len, "on_client_channel_data [is_stderr=%d]:", is_stderr);
|
||||
EXLOG_BIN((ex_u8*)data, len, "on_client_channel_data [is_stderr=%d]:", is_stderr);
|
||||
|
||||
SshSession *_this = (SshSession *)userdata;
|
||||
|
||||
|
@ -742,7 +744,7 @@ int SshSession::_on_client_channel_exec_request(ssh_session session, ssh_channel
|
|||
}
|
||||
|
||||
int SshSession::_on_server_channel_data(ssh_session session, ssh_channel channel, void *data, unsigned int len, int is_stderr, void *userdata) {
|
||||
//EXLOG_BIN((ex_u8*)data, len, "on_server_channel_data [is_stderr=%d]:", is_stderr);
|
||||
EXLOG_BIN((ex_u8*)data, len, "on_server_channel_data [is_stderr=%d]:", is_stderr);
|
||||
|
||||
SshSession *_this = (SshSession *)userdata;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ class DoUpdateAccountHandler(TPBaseJsonHandler):
|
|||
if param['auth_type'] == TP_AUTH_TYPE_PASSWORD and len(param['password']) > 0:
|
||||
code, ret_data = yield core_service_async_enc(param['password'])
|
||||
if code != TPE_OK:
|
||||
return self.write_json(code, '无法加密存储密码!')
|
||||
return self.write_json(code)
|
||||
else:
|
||||
param['password'] = ret_data
|
||||
elif param['auth_type'] == TP_AUTH_TYPE_PRIVATE_KEY and len(param['pri_key']) > 0:
|
||||
|
|
Loading…
Reference in New Issue