Skip to content

Commit 71a9e09

Browse files
committed
added:forward user verifacation supported
1 parent 19e6778 commit 71a9e09

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

XEngine_Source/XEngine_ServiceApp/XEngine_ForwardTask.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,21 @@ bool XEngine_Forward_Handle(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int n
5656
memset(&st_UserAuth, '\0', sizeof(XENGINE_PROTOCOL_USERAUTH));
5757

5858
memcpy(&st_UserAuth, lpszMsgBuffer, sizeof(XENGINE_PROTOCOL_USERAUTH));
59-
59+
//是否需要进行验证
60+
if (st_ServiceConfig.st_XAuth.bAuth)
61+
{
62+
int nHTTPCode = 0;
63+
ModuleProtocol_Packet_Auth(tszSDBuffer, &nSDLen, st_UserAuth.tszUserName, st_UserAuth.tszUserPass);
64+
if (!APIClient_Http_Request(_X("POST"), st_ServiceConfig.st_XAuth.tszAuthUrl, tszSDBuffer, &nHTTPCode))
65+
{
66+
pSt_ProtocolHdr->wReserve = 401;
67+
pSt_ProtocolHdr->unPacketSize = 0;
68+
pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_FORWARD_LOGREP;
69+
XEngine_Network_Send(lpszClientAddr, (LPCXSTR)pSt_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR), XENGINE_CLIENT_NETTYPE_FORWARD);
70+
XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("Forward客户端:%s,设置的用户:%s,密码:%s,验证失败无法继续."), lpszClientAddr, st_UserAuth.tszUserName, st_UserAuth.tszUserPass);
71+
return false;
72+
}
73+
}
6074
pSt_ProtocolHdr->wReserve = 0;
6175
pSt_ProtocolHdr->unPacketSize = 0;
6276
pSt_ProtocolHdr->unOperatorCode = XENGINE_COMMUNICATION_PROTOCOL_OPERATOR_CODE_FORWARD_LOGREP;

0 commit comments

Comments
 (0)