diff --git a/CHANGELOG b/CHANGELOG index 0d3579f..78a392b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,23 @@ +XEngine_Authorize V3.21.0.1001 + +增加:http 用户可以获取用户时间信息 +更新:cdkey管理器序列号类型 +优化:获取用户时间处理流程 +修改:加密通信支持英文字母密码了 +修改:序列号生成检测 +修正:用户等级修改不正确的问题 +修正:插入序列号失败的问题 +修正:重置密码错误 + +added:get time info for http user +update:cdkey management serial type +improved:get user time protocol process +modify:crypt communication pass word support +modify:serial generator check +fixed:user level incorrect when modify user info +fixed:insert serial number failure +fixed:reset password is incorrect +================================================================ XEngine_Authorize V3.20.0.1001 ci:centos and alma linux and debian 13 system support diff --git a/README.en.md b/README.en.md index 91ffc1c..118ae91 100644 --- a/README.en.md +++ b/README.en.md @@ -106,14 +106,36 @@ address:app.xyry.org port :tcp port 5300,websocket port 5301,http management port 5302,Transmission verification password: no encryption ## Screenshot of the program -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/1.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/2.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/3.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/4.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/5.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/6.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/7.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/8.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_1.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_2.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_3.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_4.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_5.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_6.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_7.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_8.png "在这里输入图片标题") + +## No-Code License Authorization & Verification Support +#### app packet service +If you don't have software development capabilities, don't want to implement it yourself, or want to add authorization verification to other software, we also provide an authorization packaging service, which allows your program to directly package our verification. +Program Packaging Service is a paid service, and you can package and add verification to any program. You can integrate our verification service without requiring source code or modifying your program. After packaging is complete, when it is run next time, our verification client will run first, and then your provided program will run after verification is successful, which is very convenient to use. +This service is paid, priced at 200 per package. It supports both x86 and x64 programs, and only requires you to provide your server address, port, and verification mode. The process is as follows: +Payment → Send the program to us → We package it → Verification testing → Send the packaged program to you → Completed +After packaging, when the program is launched, the following window will open first. Only after a successful login will your program start. As shown below, once launched, the main interface will be displayed. After login, the main interface will close and your program will then start. +![Main Interface](./XEngine_Picture/packet_1.png "Main Interface") +![CDKEY Login](./XEngine_Picture/packet_2.png "CDKEY Login") +![User Registration](./XEngine_Picture/packet_3.png "User Registration") +![User Recharge](./XEngine_Picture/packet_4.png "User Recharge") +![Password Recovery](./XEngine_Picture/packet_5.png "Password Recovery") +![Remaining Time](./XEngine_Picture/packet_6.png "Remaining Time") + +The verification timer will automatically stop. Supported features include login, local CDKEY verification, registration, recharge, password recovery, and remaining time query. +Note: This feature is only a packaging replacement. If you require full encryption, shell protection, and higher security, you must implement it yourself through code development. +#### Packager +We can also provide the original packager if you have more packaging needs. The packager is currently in a promotional campaign, 500 yuan. +You can choose our verification program, then select the program you want to package. Then select the configuration file, and that's it. It supports automatically updating the program icon to your software icon. +Configuration file supports configuring encryption and decryption communication and authentication mode +![Main Interface](./XEngine_Picture/packer_1.png "Main Interface") ## Participate in contribution diff --git a/README.md b/README.md index cd904d7..e8ea9b0 100644 --- a/README.md +++ b/README.md @@ -117,14 +117,36 @@ Linux or macos:直接运行即可 端口:http 5302 用于服务端管理 传输验证密码:无加密 ## 程序截图 -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/1.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/2.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/3.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/4.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/5.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/6.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/7.png "在这里输入图片标题") -![输入图片说明](https://www.xyry.org/XEngine_StructPic/authorize/8.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_1.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_2.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_3.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_4.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_5.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_6.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_7.png "在这里输入图片标题") +![输入图片说明](./XEngine_Picture/authorize_8.png "在这里输入图片标题") + +## 无代码授权验证支持 +#### 程序打包服务 +如果你没有开发软件能力或者不想自己实现或者想给其他软件添加授权验证,我们也提供了授权打包服务,这个服务可以直接让你的程序打包我们的验证. +程序打包服务是一个付费服务,你可以为任意程序打包加验证.不需要源代码不修改你的程序就可以集成我们的验证服务,当打包完成后,当下次运行,就会先运行我们的验证客户端,验证通过后再运行你提供的程序,非常方便使用. +此服务需要付费,200元3次,不限制x86或者x64位程序,你只需要告诉我们你的服务器地址端口验证模式即可.流程如下: +付费->发送程序给我们->我们打包->测试验证->发送打包程序给你->完成 +当打包后,运行程序会优先打开下面的窗口,登录成功后才会启动你的程序,如下图,开启后会显示主界面,登录后主界面会关闭,然后启动你的程序 +![主界面](./XEngine_Picture/packet_1.png "主界面") +![CDKEY登录](./XEngine_Picture/packet_2.png "CDKEY登录") +![用户注册](./XEngine_Picture/packet_3.png "用户注册") +![用户充值](./XEngine_Picture/packet_4.png "用户充值") +![找回密码](./XEngine_Picture/packet_5.png "找回密码") +![剩余时间](./XEngine_Picture/packet_6.png "剩余时间") + +会自动结束验证计时.支持登录,本地CDKEY验证,注册,充值,找回密码,获取剩余时间. +注意:此功能只是替代打包,如果你想要完全的加密加壳安全性高的,必须自己使用代码开发. +#### 打包器 +我们也可以提供原始打包器,如果你有更多打包需求.打包器目前优惠活动中,500元. +可以选择我们的验证程序,然后选择你要打包的程序.在选择配置文件即可,支持自动更新程序图标为你的软件图标. +配置文件支持配置加解密通信和验证模式 +![主界面](./XEngine_Picture/packer_1.png "主界面") ## 参与贡献 diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 4d50a50..5d645e9 100644 Binary files a/XEngine_Docment/Docment_en.docx and b/XEngine_Docment/Docment_en.docx differ diff --git a/XEngine_Docment/Docment_zh.docx b/XEngine_Docment/Docment_zh.docx index da42531..14e88a2 100644 Binary files a/XEngine_Docment/Docment_zh.docx and b/XEngine_Docment/Docment_zh.docx differ diff --git a/XEngine_Picture/authorize_1.png b/XEngine_Picture/authorize_1.png new file mode 100644 index 0000000..d8aa456 Binary files /dev/null and b/XEngine_Picture/authorize_1.png differ diff --git a/XEngine_Picture/authorize_2.png b/XEngine_Picture/authorize_2.png new file mode 100644 index 0000000..c09effa Binary files /dev/null and b/XEngine_Picture/authorize_2.png differ diff --git a/XEngine_Picture/authorize_3.png b/XEngine_Picture/authorize_3.png new file mode 100644 index 0000000..3853368 Binary files /dev/null and b/XEngine_Picture/authorize_3.png differ diff --git a/XEngine_Picture/authorize_4.png b/XEngine_Picture/authorize_4.png new file mode 100644 index 0000000..5bd3562 Binary files /dev/null and b/XEngine_Picture/authorize_4.png differ diff --git a/XEngine_Picture/authorize_5.png b/XEngine_Picture/authorize_5.png new file mode 100644 index 0000000..6de5414 Binary files /dev/null and b/XEngine_Picture/authorize_5.png differ diff --git a/XEngine_Picture/authorize_6.png b/XEngine_Picture/authorize_6.png new file mode 100644 index 0000000..1a58f95 Binary files /dev/null and b/XEngine_Picture/authorize_6.png differ diff --git a/XEngine_Picture/authorize_7.png b/XEngine_Picture/authorize_7.png new file mode 100644 index 0000000..fec10da Binary files /dev/null and b/XEngine_Picture/authorize_7.png differ diff --git a/XEngine_Picture/authorize_8.png b/XEngine_Picture/authorize_8.png new file mode 100644 index 0000000..61b138d Binary files /dev/null and b/XEngine_Picture/authorize_8.png differ diff --git a/XEngine_Picture/packer_1.png b/XEngine_Picture/packer_1.png new file mode 100644 index 0000000..5bab4cb Binary files /dev/null and b/XEngine_Picture/packer_1.png differ diff --git a/XEngine_Picture/packet_1.png b/XEngine_Picture/packet_1.png new file mode 100644 index 0000000..aa1952f Binary files /dev/null and b/XEngine_Picture/packet_1.png differ diff --git a/XEngine_Picture/packet_2.png b/XEngine_Picture/packet_2.png new file mode 100644 index 0000000..e23b73c Binary files /dev/null and b/XEngine_Picture/packet_2.png differ diff --git a/XEngine_Picture/packet_3.png b/XEngine_Picture/packet_3.png new file mode 100644 index 0000000..e06f20a Binary files /dev/null and b/XEngine_Picture/packet_3.png differ diff --git a/XEngine_Picture/packet_4.png b/XEngine_Picture/packet_4.png new file mode 100644 index 0000000..7b7a697 Binary files /dev/null and b/XEngine_Picture/packet_4.png differ diff --git a/XEngine_Picture/packet_5.png b/XEngine_Picture/packet_5.png new file mode 100644 index 0000000..6f49042 Binary files /dev/null and b/XEngine_Picture/packet_5.png differ diff --git a/XEngine_Picture/packet_6.png b/XEngine_Picture/packet_6.png new file mode 100644 index 0000000..0206704 Binary files /dev/null and b/XEngine_Picture/packet_6.png differ diff --git a/XEngine_Release/APPVer.key b/XEngine_Release/APPVer.key index 9fe9b3e..25fbd01 100644 Binary files a/XEngine_Release/APPVer.key and b/XEngine_Release/APPVer.key differ diff --git a/XEngine_Release/XEngine_Config/XEngine_Config.json b/XEngine_Release/XEngine_Config/XEngine_Config.json index 448dde1..4e7db56 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -52,7 +52,7 @@ }, "XCrypto": { "bEnable": false, - "nPass": 123123 + "tszPassKey": "123123aa" }, "XApiVer": { "bEnable": false, diff --git a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json index 3ed0431..25dc830 100644 --- a/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json +++ b/XEngine_Release/XEngine_Config/XEngine_VersionConfig.json @@ -1,7 +1,8 @@ { "XVer":[ + "V3.21.0.1001 Build20251223", "V3.20.0.1001 Build20251104", - "V3.19.0.1001 Build20250821", + "V3.19.0.1001 Build20250826", "V3.18.0.1001 Build20250510", "V3.17.0.1001 Build20250305", "V3.16.0.1001 Build20250113", diff --git a/XEngine_Release/XEngine_DataBase/SQL_User.db b/XEngine_Release/XEngine_DataBase/SQL_User.db index 651450e..b1dd332 100644 Binary files a/XEngine_Release/XEngine_DataBase/SQL_User.db and b/XEngine_Release/XEngine_DataBase/SQL_User.db differ diff --git a/XEngine_SQL/sqlite.sql b/XEngine_SQL/sqlite.sql index d100110..79cc011 100644 --- a/XEngine_SQL/sqlite.sql +++ b/XEngine_SQL/sqlite.sql @@ -10,7 +10,7 @@ Target Server Version : 3045000 (3.45.0) File Encoding : 65001 - Date: 20/08/2025 11:10:20 + Date: 22/12/2025 11:12:05 */ PRAGMA foreign_keys = false; diff --git a/XEngine_Source/AuthorizeModule_Configure/Config_Define.h b/XEngine_Source/AuthorizeModule_Configure/Config_Define.h index 2f2ba8b..48de753 100644 --- a/XEngine_Source/AuthorizeModule_Configure/Config_Define.h +++ b/XEngine_Source/AuthorizeModule_Configure/Config_Define.h @@ -81,8 +81,8 @@ typedef struct }st_XLogin; struct { + XCHAR tszCryptoKey[32]; //加密传输密钥 bool bEnable; //是否启用加密传输 - int nPassword; //密码 }st_XCrypto; struct { diff --git a/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp b/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp index fe9a25d..2cb54bf 100644 --- a/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp +++ b/XEngine_Source/AuthorizeModule_Configure/ModuleConfigure_Json/ModuleConfigure_Json.cpp @@ -154,7 +154,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE } Json::Value st_JsonXCrypto = st_JsonRoot["XCrypto"]; pSt_ServerConfig->st_XCrypto.bEnable = st_JsonXCrypto["bEnable"].asBool(); - pSt_ServerConfig->st_XCrypto.nPassword = st_JsonXCrypto["nPass"].asInt(); + _tcsxcpy(pSt_ServerConfig->st_XCrypto.tszCryptoKey, st_JsonXCrypto["tszPassKey"].asCString()); //接口验证 if (st_JsonRoot["XApiVer"].empty() || (5 != st_JsonRoot["XApiVer"].size())) { diff --git a/XEngine_Source/XAuth_Protocol.h b/XEngine_Source/XAuth_Protocol.h index 48ca685..c7ac531 100644 --- a/XEngine_Source/XAuth_Protocol.h +++ b/XEngine_Source/XAuth_Protocol.h @@ -44,6 +44,7 @@ #define ERROR_AUTHORIZE_PROTOCOL_PERMISSION 0x116 //用户权限错误 #define ERROR_AUTHORIZE_PROTOCOL_EXPIRED 0x117 //已经过期 #define ERROR_AUTHORIZE_PROTOCOL_CDKEY 0x118 //CDKEY错误 +#define ERROR_AUTHORIZE_PROTOCOL_PARSE 0x119 //协议解析错误 ////////////////////////////////////////////////////////////////////////// #define ERROR_AUTHORIZE_PROTOCOL_SERVER 0x201 //服务端内部错误 #define ERROR_AUTHORIZE_PROTOCOL_LIMIT 0x202 //服务端内部限制,数据过大后者过小 diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_CDKey.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_CDKey.cpp index e087615..d61460b 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_CDKey.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_CDKey.cpp @@ -81,7 +81,7 @@ BOOL CDialog_CDKey::OnInitDialog() USES_CONVERSION; m_ComboRegSerial.InsertString(i, A2W(lpszXSerialType[i])); } - for (int i = 0; i < 6; i++) + for (int i = 0; i < 9; i++) { USES_CONVERSION; m_ComboRegType.InsertString(i, A2W(lpszXRegType[i])); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp index 7a17f64..092dc50 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Modify.cpp @@ -215,7 +215,7 @@ void CDialog_Modify::OnBnClickedButton2() strcpy(st_UserTable.tszLeftTime, W2A(m_StrUserInfo.GetBuffer())); st_UserTable.enSerialType = (ENUM_VERIFICATION_MODULE_SERIAL_TYPE)m_ComboSerial.GetCurSel(); - st_UserTable.st_UserInfo.nUserLevel = m_ComboLeave.GetCurSel() - 1; + st_UserTable.st_UserInfo.nUserLevel = m_ComboLeave.GetCurSel(); Json::Value st_JsonRoot; Json::Value st_JsonTable; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp index 6224306..8008a9b 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeApp/Authorize_Dialog/Dialog_Serial.cpp @@ -194,6 +194,11 @@ void CDialog_Serial::OnBnClickedButton2() CString m_StrIPAddr; CString m_StrIPPort; CString m_StrToken; + CString m_StrHasTime; + CString m_StrSerialCount; + CString m_StrNumberCount; + CString m_StrExpiredTime; + XCHAR tszUrlAddr[XPATH_MAX]; CDialog_Config* pWnd = (CDialog_Config*)CDialog_Config::FromHandle(hConfigWnd); @@ -201,18 +206,21 @@ void CDialog_Serial::OnBnClickedButton2() pWnd->m_EditIPAddr.GetWindowText(m_StrIPAddr); pWnd->m_EditIPPort.GetWindowText(m_StrIPPort); pWnd->m_EditToken.GetWindowText(m_StrToken); + m_EditExpiredTime.GetWindowText(m_StrExpiredTime); + m_EditHasTime.GetWindowText(m_StrHasTime); + m_EditSerialCount.GetWindowText(m_StrSerialCount); - CString m_StrHasTime; - CString m_StrSerialCount; - CString m_StrNumberCount; - CString m_StrExpiredTime; + if (m_StrHasTime.IsEmpty() || m_StrSerialCount.IsEmpty()) + { + AfxMessageBox(_T("必须配置卡拥有的时间和生成数量")); + return; + } + Json::Value st_JsonRoot; Json::Value st_JsonArray; Json::Value st_JsonObject; - m_EditExpiredTime.GetWindowText(m_StrExpiredTime); - m_EditHasTime.GetWindowText(m_StrHasTime); - m_EditSerialCount.GetWindowText(m_StrSerialCount); + m_ComboNumber.GetLBText(m_ComboNumber.GetCurSel(), m_StrNumberCount); USES_CONVERSION; XCHAR tszTimeStr[XPATH_MIN] = {}; diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp index dc5ea38..eb242d3 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/AuthorizeHTTP_Post/AuthorizeHTTP_User.cpp @@ -8,6 +8,7 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX LPCXSTR lpszAPIRegister = _X("register"); LPCXSTR lpszAPIPay = _X("pay"); LPCXSTR lpszAPIPass = _X("pass"); + LPCXSTR lpszAPITime = _X("time"); LPCXSTR lpszAPITry = _X("try"); memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); @@ -114,14 +115,6 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX _xstprintf(st_UserTable.tszLeftTime, _X("%d"), st_AuthConfig.st_XVerification.nTryTime); st_UserTable.enSerialType = (ENUM_VERIFICATION_MODULE_SERIAL_TYPE)st_AuthConfig.st_XVerification.nTryMode; } - //禁止权限0和1注册 - if (st_UserTable.st_UserInfo.nUserLevel < 10) - { - Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_PERMISSION, "user permission level incorrect"); - XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,注册失败,配置的用户权限错误"), lpszClientAddr); - return false; - } //默认普通用户 st_UserTable.st_UserInfo.nUserLevel = 20; if (_tcsxlen(st_UserTable.st_UserInfo.tszUserName) <= 0 || _tcsxlen(st_UserTable.st_UserInfo.tszUserPass) <= 0) @@ -245,7 +238,13 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,找回重置密码失败,密码找回重置功能已经被服务器关闭!"), lpszClientAddr); return false; } + XCHAR tszNewPass[128] = {}; Protocol_Parse_HttpParseUser(lpszMsgBuffer, nMsgLen, &st_UserInfo); + if (_tcsxlen(st_UserInfo.tszUserPass) > 0) + { + _tcsxcpy(tszNewPass, st_UserInfo.tszUserPass); + memset(st_UserInfo.tszUserPass, 0, sizeof(st_UserInfo.tszUserPass)); + } //得到数据库信息 bool bSuccess = false; if (0 == st_AuthConfig.st_XSql.nDBType) @@ -272,28 +271,93 @@ bool XEngine_AuthorizeHTTP_User(XNETHANDLE xhToken, LPCXSTR lpszClientAddr, LPCX return false; } //重置密码 - if (0 == st_AuthConfig.st_XSql.nDBType) + if (_tcsxlen(tszNewPass) > 0) { - bSuccess = DBModule_SQLite_UserSet(&st_UserTable); + _xstprintf(st_UserTable.st_UserInfo.tszUserPass, _X("%s"), tszNewPass); + if (0 == st_AuthConfig.st_XSql.nDBType) + { + bSuccess = DBModule_SQLite_UserSet(&st_UserTable); + } + else + { + bSuccess = DBModule_MySQL_UserSet(&st_UserTable); + } + if (!bSuccess) + { + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_SERVER, "server set db failed"); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求修改密码失败:%s 错误码:%lX"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName, DBModule_GetLastError()); + return false; + } } - else + + XENGINE_PROTOCOL_USERAUTHEX st_AuthProtocol = {}; + _tcsxcpy(st_AuthProtocol.tszUserName, st_UserTable.st_UserInfo.tszUserName); + _tcsxcpy(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass); + Protocol_Packet_HttpUserPass(tszSDBuffer, &nSDLen, &st_AuthProtocol); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,找回重置密码成功"), lpszClientAddr, st_UserInfo.tszUserName); + } + else if (0 == _tcsxnicmp(lpszAPIName, lpszAPITime, _tcsxlen(lpszAPIName))) + { + if (!st_FunSwitch.bSwitchTime) { - bSuccess = DBModule_MySQL_UserSet(&st_UserTable); + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_CLOSED, "the function is closed"); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,获取用户时间信息失败,获取用户时间功能已经被服务器关闭!"), lpszClientAddr); + return false; } - if (!bSuccess) + XENGINE_PROTOCOL_USERAUTHEX st_UserAuth = {}; + if (!Protocol_Parse_HttpParseAuth(lpszMsgBuffer, nMsgLen, &st_UserAuth)) + { + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_PARSE, "protocol parse is incorrect"); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,获取用户时间信息失败,协议错误:%s"), lpszClientAddr, lpszMsgBuffer); + return false; + } + int nListCount = 0; + AUTHREG_USERTABLE st_UserTable = {}; + AUTHSESSION_NETCLIENT** ppSt_ListClient; + if (!Session_Authorize_GetClient(&ppSt_ListClient, &nListCount, st_UserAuth.tszUserName)) + { + //没在线,获取数据库信息 + bool bSuccess = false; + if (0 == st_AuthConfig.st_XSql.nDBType) + { + bSuccess = DBModule_SQLite_UserQuery(st_UserAuth.tszUserName, &st_UserTable); + } + else + { + bSuccess = DBModule_MySQL_UserQuery(st_UserAuth.tszUserName, &st_UserTable); + } + if (!bSuccess) + { + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_NOTFOUND, "user not found"); + XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户名:%s,获取时间失败,无法继续,错误:%lX"), lpszClientAddr, st_UserAuth.tszUserName, DBModule_GetLastError()); + return false; + } + } + //安全验证判断 + if ((0 != _tcsxncmp(st_UserAuth.tszUserName, st_UserTable.st_UserInfo.tszUserName, _tcsxlen(st_UserTable.st_UserInfo.tszUserName))) && (0 != _tcsxncmp(st_UserAuth.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcsxlen(st_UserTable.st_UserInfo.tszUserPass)))) { - Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_SERVER, "server set db failed"); + Protocol_Packet_HttpComm(tszSDBuffer, &nSDLen, ERROR_AUTHORIZE_PROTOCOL_NOTMATCH, "user information is incorrent"); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,请求修改密码失败:%s 错误码:%lX"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName, DBModule_GetLastError()); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("HTTP客户端:%s,用户名:%s,获取时间失败,验证信息失败"), lpszClientAddr, st_UserAuth.tszUserName); return false; } + nListCount = 1; + BaseLib_Memory_Malloc((XPPPMEM)&ppSt_ListClient, 1, sizeof(AUTHSESSION_NETCLIENT)); + _tcsxcpy((*ppSt_ListClient)[0].st_UserTable.st_UserInfo.tszUserName, st_UserTable.st_UserInfo.tszUserName); + _tcsxcpy((*ppSt_ListClient)[0].tszLeftTime, st_UserTable.tszLeftTime); + (*ppSt_ListClient)[0].nLeftTime = _ttxoll(st_UserTable.tszLeftTime); + (*ppSt_ListClient)[0].st_UserTable.enDeviceType = st_UserTable.enDeviceType; + (*ppSt_ListClient)[0].st_UserTable.enSerialType = st_UserTable.enSerialType; - XENGINE_PROTOCOL_USERAUTHEX st_AuthProtocol = {}; - _tcsxcpy(st_AuthProtocol.tszUserName, st_UserTable.st_UserInfo.tszUserName); - _tcsxcpy(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass); - Protocol_Packet_HttpUserPass(tszSDBuffer, &nSDLen, &st_AuthProtocol); + Protocol_Packet_UserTime(tszSDBuffer, &nSDLen, &ppSt_ListClient, nListCount); + BaseLib_Memory_Free((XPPPMEM)&ppSt_ListClient, nListCount); XEngine_Client_TaskSend(lpszClientAddr, tszSDBuffer, nSDLen, XENGINE_AUTH_APP_NETTYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,找回重置密码成功"), lpszClientAddr, st_UserInfo.tszUserName); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("HTTP客户端:%s,用户名:%s,获取时间成功"), lpszClientAddr, st_UserTable.st_UserInfo.tszUserName); } else if (0 == _tcsxnicmp(lpszAPIName, lpszAPITry, _tcsxlen(lpszAPIName))) { diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp index d09675d..d6fb0ce 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_HttpTask.cpp @@ -26,14 +26,8 @@ XHTHREAD XCALLBACK XEngine_AuthService_HttpThread(XPVOID lParam) { if (st_AuthConfig.st_XCrypto.bEnable) { - XCHAR tszPassword[64]; - XCHAR tszDeBuffer[2048]; - - memset(tszPassword, '\0', sizeof(tszPassword)); - memset(tszDeBuffer, '\0', sizeof(tszDeBuffer)); - - _xstprintf(tszPassword, _X("%d"), st_AuthConfig.st_XCrypto.nPassword); - Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszDeBuffer, tszPassword); + XCHAR tszDeBuffer[2048] = {}; + Cryption_XCrypto_Decoder(ptszMsgBuffer, &nMsgLen, tszDeBuffer, st_AuthConfig.st_XCrypto.tszCryptoKey); XEngine_Client_HttpTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, &st_HTTPParament, ppszListHdr, nHdrCount); } else diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp index f3e40a2..163e819 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_Net.cpp @@ -159,11 +159,7 @@ bool XEngine_Client_TaskSend(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int { if (st_AuthConfig.st_XCrypto.bEnable) { - XCHAR tszPassword[64]; - memset(tszPassword, '\0', sizeof(tszPassword)); - - _xstprintf(tszPassword, _X("%d"), st_AuthConfig.st_XCrypto.nPassword); - XEngine_SendMsg(lpszClientAddr, lpszMsgBuffer, nMsgLen, nNetType, tszPassword); + XEngine_SendMsg(lpszClientAddr, lpszMsgBuffer, nMsgLen, nNetType, st_AuthConfig.st_XCrypto.tszCryptoKey); } else { diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp index a64bc61..d0329c2 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_TCPTask.cpp @@ -29,14 +29,8 @@ XHTHREAD XCALLBACK XEngine_AuthService_TCPThread(XPVOID lParam) } if (st_AuthConfig.st_XCrypto.bEnable && (ENUM_XENGINE_PROTOCOLHDR_CRYPTO_TYPE_XCRYPT == st_ProtocolHdr.wCrypto)) { - XCHAR tszPassword[64]; - XCHAR tszDeBuffer[2048]; - - memset(tszPassword, '\0', sizeof(tszPassword)); - memset(tszDeBuffer, '\0', sizeof(tszDeBuffer)); - - _xstprintf(tszPassword, _X("%d"), st_AuthConfig.st_XCrypto.nPassword); - Cryption_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, tszPassword); + XCHAR tszDeBuffer[2048] = {}; + Cryption_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, st_AuthConfig.st_XCrypto.tszCryptoKey); XEngine_Client_TCPTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, &st_ProtocolHdr, XENGINE_AUTH_APP_NETTYPE_TCP); } else @@ -181,7 +175,7 @@ bool XEngine_Client_TCPTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int n XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("客户端:%s,用户名:%s,登录失败,用户名不存在"), lpszClientAddr, st_AuthProtocol.tszUserName); return false; } - if ((_tcsxlen(st_AuthProtocol.tszUserPass) != _tcsxlen(st_UserTable.st_UserInfo.tszUserPass)) || (0 != _tcsxncmp(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcsxlen(st_AuthProtocol.tszUserPass)))) + if (0 != _tcsxncmp(st_AuthProtocol.tszUserPass, st_UserTable.st_UserInfo.tszUserPass, _tcsxlen(st_UserTable.st_UserInfo.tszUserPass))) { pSt_ProtocolHdr->wReserve = ERROR_AUTHORIZE_PROTOCOL_PASS; Protocol_Packet_HDRComm(tszSDBuffer, &nSDLen, pSt_ProtocolHdr, nNetType); @@ -220,7 +214,7 @@ bool XEngine_Client_TCPTask(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int n { bSuccess = DBModule_MySQL_UserQuery(st_AuthProtocol.tszUserName, &st_UserTable, false); } - if ((_tcsxlen(st_AuthProtocol.tszUserName) != _tcsxlen(st_UserTable.tszHardCode)) || (0 != _tcsxncmp(st_AuthProtocol.tszUserName, st_UserTable.tszHardCode, _tcsxlen(st_AuthProtocol.tszUserName)))) + if (0 != _tcsxncmp(st_AuthProtocol.tszUserName, st_UserTable.tszHardCode, _tcsxlen(st_UserTable.tszHardCode))) { pSt_ProtocolHdr->wReserve = ERROR_AUTHORIZE_PROTOCOL_HARDCODE; Protocol_Packet_HDRComm(tszSDBuffer, &nSDLen, pSt_ProtocolHdr, nNetType); diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp index 982e9cd..b7dfd5d 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/Authorize_WSTask.cpp @@ -27,14 +27,8 @@ XHTHREAD XCALLBACK XEngine_AuthService_WSThread(XPVOID lParam) } if (st_AuthConfig.st_XCrypto.bEnable) { - XCHAR tszPassword[64]; - XCHAR tszDeBuffer[2048]; - - memset(tszPassword, '\0', sizeof(tszPassword)); - memset(tszDeBuffer, '\0', sizeof(tszDeBuffer)); - - _xstprintf(tszPassword, _X("%d"), st_AuthConfig.st_XCrypto.nPassword); - Cryption_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, tszPassword); + XCHAR tszDeBuffer[2048] = {}; + Cryption_XCrypto_Decoder(tszMsgBuffer, &nMsgLen, tszDeBuffer, st_AuthConfig.st_XCrypto.tszCryptoKey); XEngine_Client_WSTask(ppSt_ListClient[i]->tszClientAddr, tszDeBuffer, nMsgLen, enOPCode); } else diff --git a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp index a5e7ba4..c20c264 100644 --- a/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp +++ b/XEngine_Source/XEngine_APPService/XEngine_AuthorizeService/XEngine_AuthorizeService.cpp @@ -374,7 +374,7 @@ int main(int argc, char** argv) if (st_AuthConfig.st_XCrypto.bEnable) { - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,加密传输设置为开启,密码:%d"), st_AuthConfig.st_XCrypto.nPassword); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,加密传输设置为开启,密码:%s"), st_AuthConfig.st_XCrypto.tszCryptoKey); } else { diff --git a/XEngine_Source/XEngine_DependLibrary b/XEngine_Source/XEngine_DependLibrary index dc2e4b3..1db2b64 160000 --- a/XEngine_Source/XEngine_DependLibrary +++ b/XEngine_Source/XEngine_DependLibrary @@ -1 +1 @@ -Subproject commit dc2e4b3af5b666e888166ef1e7567475f6f03904 +Subproject commit 1db2b6460dd13016df0052808bf2f8ae82ba901f