@@ -125,7 +125,7 @@ static void XEngine_FTPUPload_Thread(xstring lpszClientAddr, xstring lpszFileNam
125125 Session_FTP_GetRetr (lpszClientAddr.c_str (), &nPos);
126126 if (nPos > 0 )
127127 {
128- pSt_File = _xfopenA (lpszFileName.c_str (), _X (" rb+" ), true );
128+ pSt_File = _xtfopen (lpszFileName.c_str (), _X (" rb+" ));
129129 if (NULL == pSt_File)
130130 {
131131 APIHelp_Port_Free (nPort);
@@ -193,7 +193,6 @@ static void XEngine_FTPUPload_Thread(xstring lpszClientAddr, xstring lpszFileNam
193193 Cryption_Api_Digest (lpszFileName.c_str (), tszHashStr, &nHashLen, true , st_ServiceCfg.st_XStorage .nHashMode );
194194 BaseLib_String_StrToHex ((LPCXSTR )tszHashStr, nHashLen, st_ProtocolFile.st_ProtocolFile .tszFileHash );
195195
196- _tcsxcpy (st_ProtocolFile.st_ProtocolFile .tszFileUser , st_ServiceCfg.st_XFtp .tszFTPDir );
197196 _tcsxcpy (st_ProtocolFile.tszBuckKey , st_ServiceCfg.st_XFtp .tszFTPDir );
198197 st_ProtocolFile.st_ProtocolFile .nFileSize = nllCount;
199198
@@ -204,7 +203,7 @@ static void XEngine_FTPUPload_Thread(xstring lpszClientAddr, xstring lpszFileNam
204203 {
205204 Database_File_FileInsert (&st_ProtocolFile, st_StorageBucket.st_PermissionFlags .bRewrite );
206205 }
207- XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO , _X (" FTP客户端:%s 请求上传文件完毕, 插入数据库完毕,BucketName:%s,Table:%s, Path:%s%s,Hash:%s,Size:%lld" ), lpszClientAddr.c_str (), st_ProtocolFile.tszBuckKey , st_ProtocolFile. tszTableName , st_ProtocolFile.st_ProtocolFile .tszFilePath , st_ProtocolFile.st_ProtocolFile .tszFileName , st_ProtocolFile.st_ProtocolFile .tszFileHash , st_ProtocolFile.st_ProtocolFile .nFileSize );
206+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO , _X (" FTP客户端:%s 请求上传文件完毕, 插入数据库完毕,BucketName:%s,Path:%s%s,Hash:%s,Size:%lld" ), lpszClientAddr.c_str (), st_ProtocolFile.tszBuckKey , st_ProtocolFile.st_ProtocolFile .tszFilePath , st_ProtocolFile.st_ProtocolFile .tszFileName , st_ProtocolFile.st_ProtocolFile .tszFileHash , st_ProtocolFile.st_ProtocolFile .nFileSize );
208207 }
209208 // 通知
210209 int nSDLen = 1024 ;
@@ -343,8 +342,16 @@ bool XEngine_Task_FTP(LPCXSTR lpszClientAddr, XENGINE_KEYVALUE *pSt_KeyValue, in
343342 return false ;
344343 }
345344 }
346- // 转换
347- Session_FTP_Set (lpszClientAddr, NULL , st_ServiceCfg.st_XFtp .tszFTPDir );
345+ // 路径转换
346+ XENGINE_STORAGEBUCKET st_StorageBucket = {};
347+ if (!APIHelp_Distributed_CTStorage (st_ServiceCfg.st_XFtp .tszFTPDir , st_LoadbalanceCfg.st_LoadBalance .pStl_ListBucket , &st_StorageBucket))
348+ {
349+ FTPProtocol_Parse_SendPacketEx (xhFTPContral, XENGINE_FTPROTOCOL_RESPONSE_421 , tszSDBuffer, &nSDLen);
350+ XEngine_Net_SendMsg (lpszClientAddr, tszSDBuffer, nSDLen, nNetType);
351+ XLOG_PRINT (xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR , _X (" FTP客户端:%s,请求登录失败,服务器配置错误,无法继续,错误:%lX" ), lpszClientAddr, StorageHelp_GetLastError ());
352+ return false ;
353+ }
354+ Session_FTP_Set (lpszClientAddr, NULL , st_StorageBucket.tszFilePath );
348355 Session_FTP_SetUser (lpszClientAddr, NULL , pSt_KeyValue->tszStrVlu );
349356
350357 FTPProtocol_Parse_SendPacketEx (xhFTPContral, XENGINE_FTPROTOCOL_RESPONSE_230 , tszSDBuffer, &nSDLen);
0 commit comments