|
@@ -562,30 +562,41 @@ bool update_rootCfg(sp_cfg_root_ini_t* root, std::map <std::string, std::map<std
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-int sp_cfg_getVer(char *ver)
|
|
|
+SPBASE_API int sp_cfg_getVer(char *ver)
|
|
|
{
|
|
|
static CSimpleStringA s_terminalVer;
|
|
|
if (s_terminalVer.GetLength() == 0)//only init s_terminalVer one time
|
|
|
{
|
|
|
CSimpleStringA strActiveFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "active.txt", sp_get_env()->dir->root_ver_path);
|
|
|
- std::ifstream iFile(strActiveFile.GetData());
|
|
|
- if (!iFile.is_open()) {
|
|
|
- LogError(Severity_Low, Error_Unexpect, 0, "open active.txt fail");
|
|
|
- return Error_Unexpect;
|
|
|
+ char version[SP_MAX_VER_LEN];
|
|
|
+ int result;
|
|
|
+ if ((result = sp_dir_inner_get_content(strActiveFile, version)) == 0) {
|
|
|
+ s_terminalVer = version;
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("read active.txt, version[%s]", s_terminalVer.GetData());
|
|
|
}
|
|
|
+ else {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sprintf_s(ver, SP_MAX_VER_LEN, "%s", s_terminalVer.GetData());
|
|
|
+ return Error_Succeed;
|
|
|
+}
|
|
|
|
|
|
- std::ostringstream buffer;
|
|
|
- buffer << iFile.rdbuf();
|
|
|
- std::string myString = buffer.str();
|
|
|
- // 去除空格
|
|
|
- myString.erase(std::remove(myString.begin(), myString.end(), ' '), myString.end());
|
|
|
- // 去除换行符
|
|
|
- myString.erase(std::remove(myString.begin(), myString.end(), '\r'), myString.end());
|
|
|
- myString.erase(std::remove(myString.begin(), myString.end(), '\n'), myString.end());
|
|
|
-
|
|
|
- s_terminalVer = myString.c_str();
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("read active.txt, version[%s]", s_terminalVer.GetData());
|
|
|
+SPBASE_API int sp_cfg_getDepVer(char* ver)
|
|
|
+{
|
|
|
+ static CSimpleStringA s_terminalVer;
|
|
|
+ if (s_terminalVer.GetLength() == 0)//only init s_terminalVer one time
|
|
|
+ {
|
|
|
+ CSimpleStringA strActiveFile = CSimpleStringA::Format("%s" SPLIT_SLASH_STR ADAPTER_VERSION_FILE_NAME, sp_get_env()->dir->dep_base_path);
|
|
|
+ char version[SP_MAX_VER_LEN];
|
|
|
+ int result;
|
|
|
+ if ((result = sp_dir_inner_get_content(strActiveFile, version)) == 0) {
|
|
|
+ s_terminalVer = version;
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("read dep version text, version[%s]", s_terminalVer.GetData());
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
sprintf_s(ver, SP_MAX_VER_LEN, "%s", s_terminalVer.GetData());
|
|
|
return Error_Succeed;
|
|
@@ -1892,60 +1903,6 @@ static inline int shell_ini__load_software_version(sp_cfg_shell_ini_t* shell, co
|
|
|
return rc;
|
|
|
}
|
|
|
|
|
|
-static int sp_cfg_get_vertify_sign(sp_dir_t* dir, sp_cfg_root_ini_t* root)
|
|
|
-{
|
|
|
- CSimpleStringA strCenterSettingFullPath;
|
|
|
- strCenterSettingFullPath = dir->cfg_path;
|
|
|
-
|
|
|
- strCenterSettingFullPath += SPLIT_SLASH_STR "CenterSetting.ini";
|
|
|
- CSimpleStringA oldCenterSettingFullPath = dir->cfg_path;
|
|
|
-
|
|
|
- if (root->site == NULL || strlen(root->site) == 0) {
|
|
|
- oldCenterSettingFullPath += SPLIT_SLASH_STR "CenterSetting.ini";
|
|
|
- } else if ((stricmp(root->site, "CMB.LIB") == 0) // 行内大堂
|
|
|
- || (stricmp(root->site, "CMB.SSB") == 0))// 自助网点
|
|
|
- {
|
|
|
- oldCenterSettingFullPath += SPLIT_SLASH_STR "CenterSetting.LAN.ini";
|
|
|
- } else if ((stricmp(root->site, "CMB.LSS") == 0) // 生活销售机
|
|
|
- || (stricmp(root->site, "CMB.FLB") == 0) // 离行机器
|
|
|
- || (stricmp(root->site, "CMB.OSB") == 0) // 外拓PAD
|
|
|
- || (stricmp(root->site, "CMB.SMM") == 0)) // 商户终端
|
|
|
- {
|
|
|
- oldCenterSettingFullPath += SPLIT_SLASH_STR "CenterSetting.DMZ.ini";
|
|
|
- } else {
|
|
|
- oldCenterSettingFullPath += SPLIT_SLASH_STR "CenterSetting.DMZ.ini";
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- ///*TODO(80374374@3/14/2023): 该操作目前仅在Win端支持,UOS还未做改造 */
|
|
|
-#if defined(_MSC_VER)
|
|
|
- if (!ExistsFileA(strCenterSettingFullPath.GetData()) && ExistsFileA(oldCenterSettingFullPath.GetData())) {
|
|
|
- //拷贝已经存在的centersetting去替换centersetting.ini
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__).setVtmCode(DWORD2Hex(ERR_SPSHELL_COPY_CEN))("since %s not exist, copy %s to replace it, result:%s",
|
|
|
- strCenterSettingFullPath.GetData(), oldCenterSettingFullPath.GetData(),
|
|
|
- CopyFileA(oldCenterSettingFullPath.GetData(), strCenterSettingFullPath.GetData(), TRUE) ? "success" : "failed");
|
|
|
-}
|
|
|
-#else
|
|
|
- strCenterSettingFullPath = oldCenterSettingFullPath;
|
|
|
-#endif //_MSC_VER
|
|
|
-
|
|
|
- //add (const char*) for fixing string print bug. Gifur
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("centersettings full path=%s!", (const char*)strCenterSettingFullPath);
|
|
|
-
|
|
|
- //add by zl 20170717,从集中配置读取代码签名开关[VerifyCodeSign]
|
|
|
- const int nVerifyCodeSign = inifile_read_int(strCenterSettingFullPath, "SpBase", "VerifyCodeSign", 0);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("get VerifyCodeSign=%d from [%s] ini", nVerifyCodeSign, strCenterSettingFullPath.GetData());
|
|
|
- return nVerifyCodeSign > 0 ? 1 : 0;
|
|
|
-}
|
|
|
-#ifdef _WIN32
|
|
|
-CSimpleStringA getDefaultCenterSettingPath(sp_dir_t* dir)
|
|
|
-{
|
|
|
- CSimpleStringA strCenterSettingFullPath;
|
|
|
- strCenterSettingFullPath = dir->cfg_path;
|
|
|
- strCenterSettingFullPath += "\\CenterSetting.ini";
|
|
|
- return strCenterSettingFullPath;
|
|
|
-}
|
|
|
-#endif //_WIN32
|
|
|
void init_shellVer(sp_dir_t* dir, CVersionInfo &shellVerInfo)
|
|
|
{
|
|
|
#ifdef _WIN32
|
|
@@ -2551,36 +2508,6 @@ static int generate_install_ini(sp_dir_t *dir)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#ifdef _WIN32
|
|
|
-void copyOldCenterSetting(sp_dir_t* dir, sp_cfg_root_ini_t* root)
|
|
|
-{
|
|
|
- CSimpleStringA strCenterSettingFullPath = getDefaultCenterSettingPath(dir);
|
|
|
- CSimpleStringA oldCenterSettingFullPath = dir->cfg_path;
|
|
|
-
|
|
|
-
|
|
|
- if ((stricmp(root->site, "CMB.LIB") == 0) // 行内大堂
|
|
|
- || (stricmp(root->site, "CMB.SSB") == 0))// 自助网点
|
|
|
- oldCenterSettingFullPath += "\\CenterSetting.LAN.ini";
|
|
|
- else if ((stricmp(root->site, "CMB.LSS") == 0) // 生活销售机
|
|
|
- || (stricmp(root->site, "CMB.FLB") == 0) // 离行机器
|
|
|
- || (stricmp(root->site, "CMB.OSB") == 0) // 外拓PAD
|
|
|
- || (stricmp(root->site, "CMB.SMM") == 0)) // 商户终端
|
|
|
- oldCenterSettingFullPath += "\\CenterSetting.DMZ.ini";
|
|
|
- else
|
|
|
- oldCenterSettingFullPath += "\\CenterSetting.DMZ.ini";
|
|
|
-
|
|
|
- if (!fileExist(strCenterSettingFullPath.GetData()) && fileExist(oldCenterSettingFullPath.GetData()))
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__).setVtmCode(DWORD2Hex(ERR_SPSHELL_COPY_CEN))("since %s not exist, copy %s to replace it, result:%s",
|
|
|
- strCenterSettingFullPath.GetData(), oldCenterSettingFullPath.GetData(),
|
|
|
- CopyFileA(oldCenterSettingFullPath.GetData(), strCenterSettingFullPath.GetData(), TRUE) ? "success" : "failed");//拷贝已经存在的centersetting去替换centersetting.ini
|
|
|
-
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("strCenterSettingFullPath=%s!", strCenterSettingFullPath);
|
|
|
-}
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
int sp_cfg_create(sp_dir_t* dir, const sp_cfg_start_args_t* args, sp_cfg_t** p_cfg)
|
|
|
{
|
|
|
sp_cfg_t *cfg;
|
|
@@ -2656,15 +2583,10 @@ int sp_cfg_create(sp_dir_t* dir, const sp_cfg_start_args_t* args, sp_cfg_t** p_c
|
|
|
shellvarPath = shell_var_path;
|
|
|
|
|
|
/*override*/
|
|
|
- cfg->args->sign_verifity = sp_cfg_get_vertify_sign(dir, cfg->root_ini);
|
|
|
+ cfg->args->sign_verifity = 0;
|
|
|
if (cfg->args->sign_verifity) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("verify code sign required.");
|
|
|
}
|
|
|
- /*
|
|
|
-#if defined(_MSC_VER)
|
|
|
- copyOldCenterSetting(dir, cfg->root_ini);//解决集中配置存在旧配置问题
|
|
|
-#endif
|
|
|
-*/
|
|
|
|
|
|
SetTokenCallBack(shell_getHttpToken);
|
|
|
SetRestfulTokenCallBack(shell_getHttpToken);
|