mirror of https://github.com/tp4a/teleport
RDP功能恢复到v2的状态了,准备尝试支持系统原生RDP客户端。
parent
b2a2316e96
commit
507ef71766
|
@ -23,46 +23,4 @@
|
|||
#define TS_RDP_PROTOCOL_RDSTLS 4
|
||||
#define TS_RDP_PROTOCOL_HYBRID_EX 8
|
||||
|
||||
// #define TS_AUTH_MODE_NONE 0
|
||||
// #define TS_AUTH_MODE_PASSWORD 1
|
||||
// #define TS_AUTH_MODE_PRIVATE_KEY 2
|
||||
//
|
||||
// #define TS_PROXY_PROTOCOL_RDP 1
|
||||
// #define TS_PROXY_PROTOCOL_SSH 2
|
||||
// #define TS_PROXY_PROTOCOL_TELNET 3
|
||||
|
||||
// #define TSR_OK 0x0000
|
||||
// #define TSR_INVALID_DATA 0x0001
|
||||
// #define TSR_SEND_ERROR 0x0002
|
||||
// #define TSR_NEED_MORE_DATA 0x0005
|
||||
// #define TSR_FAILED 0x0006
|
||||
// #define TSR_DATA_LEN_ZERO 0x0007
|
||||
//
|
||||
// #define TSR_MAX_CONN_REACHED 0x0010
|
||||
// #define TSR_MAX_HOST_REACHED 0x0011
|
||||
//
|
||||
// #define TSR_INVALID_REQUEST 0x1000
|
||||
// #define TSR_INVALID_URI 0x1001
|
||||
// #define TSR_INVALID_URL_ENCODE 0x1002
|
||||
// #define TSR_NO_SUCH_METHOD 0x1003
|
||||
// #define TSR_INVALID_JSON_FORMAT 0x1004
|
||||
// #define TSR_INVALID_JSON_PARAM 0x1005
|
||||
// #define TSR_GETAUTH_INFO_ERROR 0x1006
|
||||
// #define TSR_HOST_LOCK_ERROR 0x1007
|
||||
// #define TSR_ACCOUNT_LOCK_ERROR 0x1008
|
||||
|
||||
//================================================
|
||||
// #define SESS_STAT_RUNNING 0 // 会话开始了,尚未结束
|
||||
// #define SESS_STAT_END 9999 // 会话成功结束
|
||||
// #define SESS_STAT_ERR_AUTH_DENIED 1 // 会话结束,因为认证失败
|
||||
// #define SESS_STAT_ERR_CONNECT 2 // 会话结束,因为无法连接到远程主机
|
||||
// #define SESS_STAT_ERR_BAD_SSH_KEY 3 // 会话结束,因为无法识别SSH私钥
|
||||
// #define SESS_STAT_ERR_INTERNAL 4 // 会话结束,因为内部错误
|
||||
// #define SESS_STAT_ERR_UNSUPPORT_PROTOCOL 5 // 会话结束,因为协议不支持(RDP)
|
||||
// #define SESS_STAT_ERR_BAD_PKG 6 // 会话结束,因为收到错误的报文
|
||||
// #define SESS_STAT_ERR_RESET 7 // 会话结束,因为teleport核心服务重置了
|
||||
// #define SESS_STAT_ERR_IO 8 // 会话结束,因为网络中断
|
||||
// #define SESS_STAT_ERR_SESSION 9 // 会话结束,因为无效的会话ID
|
||||
|
||||
|
||||
#endif // __TS_ERRNO_H__
|
||||
|
|
|
@ -103,7 +103,7 @@ void TppSshRec::record_win_size_change(int width, int height)
|
|||
record(TS_RECORD_TYPE_SSH_TERM_SIZE, (ex_u8*)&pkg, sizeof(TS_RECORD_WIN_SIZE));
|
||||
}
|
||||
|
||||
// TODO: 为了录像回放和命令历史能够对应(比如点击命令直接跳到录像的对应时点),应该仿照录像数据包的方式记录相对时间偏移,而不是绝对时间。
|
||||
// 为了录像回放和命令历史能够对应(比如点击命令直接跳到录像的对应时点),仿照录像数据包的方式记录相对时间偏移,而不是绝对时间。
|
||||
void TppSshRec::record_command(int flag, const ex_astr& cmd)
|
||||
{
|
||||
char szTime[100] = { 0 };
|
||||
|
|
|
@ -11,7 +11,7 @@ TP_SSH_CHANNEL_PAIR::TP_SSH_CHANNEL_PAIR() {
|
|||
cli_channel = NULL;
|
||||
srv_channel = NULL;
|
||||
|
||||
retcode = TP_SESS_STAT_RUNNING;
|
||||
state = TP_SESS_STAT_RUNNING;
|
||||
db_id = 0;
|
||||
channel_id = 0;
|
||||
|
||||
|
@ -127,13 +127,13 @@ void SshSession::_record_end(TP_SSH_CHANNEL_PAIR* cp)
|
|||
{
|
||||
if (cp->db_id > 0)
|
||||
{
|
||||
//EXLOGD("[ssh] [channel:%d] channel end with code: %d\n", cp->channel_id, cp->retcode);
|
||||
//EXLOGD("[ssh] [channel:%d] channel end with code: %d\n", cp->channel_id, cp->state);
|
||||
|
||||
// 如果会话过程中没有发生错误,则将其状态改为结束,否则记录下错误值
|
||||
if (cp->retcode == TP_SESS_STAT_RUNNING || cp->retcode == TP_SESS_STAT_STARTED)
|
||||
cp->retcode = TP_SESS_STAT_END;
|
||||
if (cp->state == TP_SESS_STAT_RUNNING || cp->state == TP_SESS_STAT_STARTED)
|
||||
cp->state = TP_SESS_STAT_END;
|
||||
|
||||
g_ssh_env.session_end(m_sid.c_str(), cp->db_id, cp->retcode);
|
||||
g_ssh_env.session_end(m_sid.c_str(), cp->db_id, cp->state);
|
||||
|
||||
cp->db_id = 0;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
|
|||
_this->m_sid = user;
|
||||
EXLOGV("[ssh] authenticating, session-id: %s\n", _this->m_sid.c_str());
|
||||
|
||||
int protocol = 0;
|
||||
// int protocol = 0;
|
||||
//TPP_CONNECT_INFO* sess_info = g_ssh_env.get_connect_info(_this->m_sid.c_str());
|
||||
_this->m_conn_info = g_ssh_env.get_connect_info(_this->m_sid.c_str());
|
||||
|
||||
|
@ -336,16 +336,15 @@ int SshSession::_on_auth_password_request(ssh_session session, const char *user,
|
|||
_this->m_auth_type = _this->m_conn_info->auth_type;
|
||||
_this->m_acc_name = _this->m_conn_info->acc_username;
|
||||
_this->m_acc_secret = _this->m_conn_info->acc_secret;
|
||||
protocol = _this->m_conn_info->protocol_type;
|
||||
//protocol = _this->m_conn_info->protocol_type;
|
||||
if (_this->m_conn_info->protocol_type != TP_PROTOCOL_TYPE_SSH) {
|
||||
EXLOGE("[ssh] session '%s' is not for SSH.\n", _this->m_sid.c_str());
|
||||
_this->m_have_error = true;
|
||||
_this->_session_error(TP_SESS_STAT_ERR_INTERNAL);
|
||||
return SSH_AUTH_DENIED;
|
||||
}
|
||||
}
|
||||
|
||||
if (protocol != TP_PROTOCOL_TYPE_SSH) {
|
||||
EXLOGE("[ssh] session '%s' is not for SSH.\n", _this->m_sid.c_str());
|
||||
_this->m_have_error = true;
|
||||
_this->_session_error(TP_SESS_STAT_ERR_INTERNAL);
|
||||
return SSH_AUTH_DENIED;
|
||||
}
|
||||
|
||||
|
||||
// 现在尝试根据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();
|
||||
|
@ -722,7 +721,7 @@ int SshSession::_on_client_channel_subsystem_request(ssh_session session, ssh_ch
|
|||
// 目前只支持SFTP子系统
|
||||
if (strcmp(subsystem, "sftp") != 0) {
|
||||
EXLOGE("[ssh] support `sftp` subsystem only, but got `%s`.\n", subsystem);
|
||||
cp->retcode = TP_SESS_STAT_ERR_UNSUPPORT_PROTOCOL;
|
||||
cp->state = TP_SESS_STAT_ERR_UNSUPPORT_PROTOCOL;
|
||||
return SSH_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
|
||||
TppSshRec rec;
|
||||
|
||||
int retcode;
|
||||
int state;
|
||||
int db_id;
|
||||
int channel_id; // for debug only.
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ $app.on_table_host_cell_created = function (tbl, row_id, col_key, cell_obj) {
|
|||
console.log(uni_id, protocol_sub_type);
|
||||
|
||||
if (action === 'rdp') {
|
||||
$tp.notify_error('尚未实现!');
|
||||
$app.connect_remote(uni_id, TP_PROTOCOL_TYPE_RDP, TP_PROTOCOL_TYPE_RDP_DESKTOP);
|
||||
} else if (action === 'ssh') {
|
||||
$app.connect_remote(uni_id, TP_PROTOCOL_TYPE_SSH, protocol_sub_type);
|
||||
} else if (action === 'telnet') {
|
||||
|
|
Loading…
Reference in New Issue