diff --git a/external/readme.md b/external/readme.md index 6277233..ef7d3ed 100644 --- a/external/readme.md +++ b/external/readme.md @@ -27,4 +27,5 @@ teleport项目用到的第三方库 https://github.com/ARMmbed/mbedtls mbedtls-mbedtls-2.2.1 注意:teleport项目使用源代码直接编译,因此解压缩源代码到此即可。 +- libssh diff --git a/server/tp_core/core/ts_http_rpc.cpp b/server/tp_core/core/ts_http_rpc.cpp index 7294f85..c3708f1 100644 --- a/server/tp_core/core/ts_http_rpc.cpp +++ b/server/tp_core/core/ts_http_rpc.cpp @@ -340,40 +340,47 @@ void TsHttpRpc::_rpc_func_request_session(const Json::Value& json_param, ex_astr int protocol = 0; int is_enc = 1; - // TODO: authidΪһڱ֤IDǸһʱ֤IDӲԣΪ0򱨴 - if (!json_param["authid"].isNull()) + // authidΪһڱ֤IDǸһʱ֤IDӲԣΪ0򱨴 + + if (json_param["authid"].isNull()) { - // ʹ֤IDķʽSID - if (!json_param["authid"].isInt()) - { - _create_json_ret(buf, TSR_INVALID_JSON_PARAM); - return; - } - - authid = json_param["authid"].asInt(); - - Json::Value jret; - if (!ts_web_rpc_get_auth_info(authid, jret)) - { - _create_json_ret(buf, TSR_GETAUTH_INFO_ERROR); - return; - } - - Json::Value& _jret = jret["data"]; - - host_ip = _jret["host_ip"].asString(); - host_port = _jret["host_port"].asInt(); - //host_lock = 0; - sys_type = _jret["sys_type"].asInt(); - protocol = _jret["protocol"].asInt(); - is_enc = _jret["encrypt"].asInt() == 0 ? false : true; - auth_mode = _jret["auth_mode"].asInt(); - account_lock = _jret["account_lock"].asInt() == 0 ? true : false; - user_name = _jret["user_name"].asString(); - user_auth = _jret["user_auth"].asString(); - user_param = _jret["user_param"].asString(); - account_name = _jret["account_name"].asString(); + _create_json_ret(buf, TSR_INVALID_JSON_PARAM); + return; } + if (!json_param["authid"].isInt()) + { + _create_json_ret(buf, TSR_INVALID_JSON_PARAM); + return; + } + + authid = json_param["authid"].asInt(); + if (0 == authid) + { + _create_json_ret(buf, TSR_INVALID_JSON_PARAM); + return; + } + + Json::Value jret; + if (!ts_web_rpc_get_auth_info(authid, jret)) + { + _create_json_ret(buf, TSR_GETAUTH_INFO_ERROR); + return; + } + + Json::Value& _jret = jret["data"]; + + host_ip = _jret["host_ip"].asString(); + host_port = _jret["host_port"].asInt(); + //host_lock = 0; + sys_type = _jret["sys_type"].asInt(); + protocol = _jret["protocol"].asInt(); + is_enc = _jret["encrypt"].asInt() == 0 ? false : true; + auth_mode = _jret["auth_mode"].asInt(); + account_lock = _jret["account_lock"].asInt() == 0 ? true : false; + user_name = _jret["user_name"].asString(); + user_auth = _jret["user_auth"].asString(); + user_param = _jret["user_param"].asString(); + account_name = _jret["account_name"].asString(); // һжϲǷϷ