From 9eb1f600488d3be436064f2c96e5fc0945dbc6b4 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Fri, 11 Mar 2011 12:14:24 +0000 Subject: [PATCH] - added option to disable file transfers for tileset and/or techtrees for published (internet) games --- .../menu/menu_state_custom_game.cpp | 19 +++- source/glest_game/menu/menu_state_options.cpp | 37 +++++++ source/glest_game/menu/menu_state_options.h | 6 ++ source/glest_game/network/network_manager.cpp | 4 +- source/glest_game/network/network_manager.h | 2 +- .../glest_game/network/server_interface.cpp | 16 ++- source/glest_game/network/server_interface.h | 5 +- .../shared_lib/include/feathery_ftp/ftpIfc.h | 1 + .../include/platform/posix/miniftpserver.h | 7 ++ .../sources/feathery_ftp/ftpAccount.c | 15 +++ .../sources/platform/posix/miniftpserver.cpp | 98 +++++++++++++++---- 11 files changed, 180 insertions(+), 30 deletions(-) diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index 43a697c6..53755519 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -87,7 +87,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b serverInitError = false; try { - networkManager.init(nrServer); + networkManager.init(nrServer,openNetworkSlots); } catch(const std::exception &ex) { serverInitError = true; @@ -95,7 +95,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b sprintf(szBuf,"In [%s::%s %d] Error detected:\n%s\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError,szBuf); SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s",szBuf); - //throw runtime_error(szBuf);!!! + //throw runtime_error(szBuf); showGeneralError=true; generalErrorToShow = ex.what(); @@ -314,10 +314,12 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b listBoxPublishServer.init(50, networkPos, 100); listBoxPublishServer.pushBackItem(lang.get("Yes")); listBoxPublishServer.pushBackItem(lang.get("No")); - if(openNetworkSlots) + if(openNetworkSlots) { listBoxPublishServer.setSelectedItemIndex(0); - else + } + else { listBoxPublishServer.setSelectedItemIndex(1); + } // Network Frame Period //labelNetworkFramePeriod.registerGraphicComponent(containerName,"labelNetworkFramePeriod"); @@ -792,6 +794,9 @@ void MenuStateCustomGame::mouseClick(int x, int y, MouseButton mouseButton){ MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); needToRepublishToMasterserver = true; soundRenderer.playFx(coreData.getClickSoundC()); + + ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface(); + serverInterface->setPublishEnabled(listBoxPublishServer.getSelectedItemIndex() == 0); } else if(listBoxAdvanced.getSelectedItemIndex() == 1 && listBoxNetworkPauseGameForLaggedClients.mouseClick(x, y)){ MutexSafeWrapper safeMutex((publishToMasterserverThread != NULL ? publishToMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(__FILE__) + "_" + intToStr(__LINE__)); @@ -1445,6 +1450,9 @@ void MenuStateCustomGame::update() { showMessageBox( masterServererErrorToShow, lang.get("ErrorFromMasterserver"), false); listBoxPublishServer.setSelectedItemIndex(1); + + ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface(); + serverInterface->setPublishEnabled(listBoxPublishServer.getSelectedItemIndex() == 0); } else if(showGeneralError) { SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -1734,6 +1742,9 @@ void MenuStateCustomGame::update() { { listBoxPublishServer.setSelectedItemIndex(1); listBoxPublishServer.setEditable(false); + + ServerInterface* serverInterface= NetworkManager::getInstance().getServerInterface(); + serverInterface->setPublishEnabled(listBoxPublishServer.getSelectedItemIndex() == 0); //listBoxEnableServerControlledAI.setEditable(false); } diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index 263223dc..6f4f8ad5 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -376,6 +376,28 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu): labelFTPServerDataPorts.init(currentColumnStart,currentLine ); labelFTPServerDataPorts.setText(szBuf); currentLine-=30; + + labelEnableFTPServerInternetTilesetXfer.registerGraphicComponent(containerName,"labelEnableFTPServerInternetTilesetXfer"); + labelEnableFTPServerInternetTilesetXfer.init(currentLabelStart ,currentLine ); + labelEnableFTPServerInternetTilesetXfer.setText(lang.get("EnableFTPServerInternetTilesetXfer")); + + checkBoxEnableFTPServerInternetTilesetXfer.registerGraphicComponent(containerName,"checkBoxEnableFTPServerInternetTilesetXfer"); + checkBoxEnableFTPServerInternetTilesetXfer.init(currentColumnStart ,currentLine ); + checkBoxEnableFTPServerInternetTilesetXfer.setValue(config.getBool("EnableFTPServerInternetTilesetXfer","true")); + + currentLine-=30; + + labelEnableFTPServerInternetTechtreeXfer.registerGraphicComponent(containerName,"labelEnableFTPServerInternetTechtreeXfer"); + labelEnableFTPServerInternetTechtreeXfer.init(currentLabelStart ,currentLine ); + labelEnableFTPServerInternetTechtreeXfer.setText(lang.get("EnableFTPServerInternetTechtreeXfer")); + + checkBoxEnableFTPServerInternetTechtreeXfer.registerGraphicComponent(containerName,"checkBoxEnableFTPServerInternetTechtreeXfer"); + checkBoxEnableFTPServerInternetTechtreeXfer.init(currentColumnStart ,currentLine ); + checkBoxEnableFTPServerInternetTechtreeXfer.setValue(config.getBool("EnableFTPServerInternetTechtreeXfer","true")); + + currentLine-=30; + + // FTP config end // Privacy flag @@ -546,6 +568,9 @@ void MenuStateOptions::mouseClick(int x, int y, MouseButton mouseButton){ checkBoxEnableFTP.mouseClick(x, y); checkBoxEnableFTPServer.mouseClick(x, y); + checkBoxEnableFTPServerInternetTilesetXfer.mouseClick(x, y); + checkBoxEnableFTPServerInternetTechtreeXfer.mouseClick(x, y); + checkBoxEnablePrivacy.mouseClick(x, y); } } @@ -580,6 +605,9 @@ void MenuStateOptions::mouseMove(int x, int y, const MouseState *ms){ checkBoxEnableFTP.mouseMove(x, y); checkBoxEnableFTPServer.mouseMove(x, y); + checkBoxEnableFTPServerInternetTilesetXfer.mouseMove(x, y); + checkBoxEnableFTPServerInternetTechtreeXfer.mouseMove(x, y); + checkBoxEnablePrivacy.mouseMove(x, y); } @@ -692,6 +720,11 @@ void MenuStateOptions::render(){ renderer.renderLabel(&labelFTPServerDataPortsLabel); renderer.renderLabel(&labelFTPServerDataPorts); + renderer.renderLabel(&labelEnableFTPServerInternetTilesetXfer); + renderer.renderCheckBox(&checkBoxEnableFTPServerInternetTilesetXfer); + renderer.renderLabel(&labelEnableFTPServerInternetTechtreeXfer); + renderer.renderCheckBox(&checkBoxEnableFTPServerInternetTechtreeXfer); + renderer.renderLabel(&labelEnablePrivacy); renderer.renderCheckBox(&checkBoxEnablePrivacy); } @@ -732,6 +765,10 @@ void MenuStateOptions::saveConfig(){ config.setInt("FTPServerPort",config.getInt("MasterServerExternalPort")+1); config.setBool("EnableFTPXfer", checkBoxEnableFTP.getValue()); config.setBool("EnableFTPServer", checkBoxEnableFTPServer.getValue()); + + config.setBool("EnableFTPServerInternetTilesetXfer", checkBoxEnableFTPServerInternetTilesetXfer.getValue()); + config.setBool("EnableFTPServerInternetTechtreeXfer", checkBoxEnableFTPServerInternetTechtreeXfer.getValue()); + config.setBool("PrivacyPlease", checkBoxEnablePrivacy.getValue()); string currentResolution=config.getString("ScreenWidth")+"x"+config.getString("ScreenHeight"); diff --git a/source/glest_game/menu/menu_state_options.h b/source/glest_game/menu/menu_state_options.h index 7c58d557..2aa89f81 100644 --- a/source/glest_game/menu/menu_state_options.h +++ b/source/glest_game/menu/menu_state_options.h @@ -96,6 +96,12 @@ private: GraphicLabel labelFTPServerDataPortsLabel; GraphicLabel labelFTPServerDataPorts; + GraphicLabel labelEnableFTPServerInternetTilesetXfer; + GraphicCheckBox checkBoxEnableFTPServerInternetTilesetXfer; + + GraphicLabel labelEnableFTPServerInternetTechtreeXfer; + GraphicCheckBox checkBoxEnableFTPServerInternetTechtreeXfer; + GraphicLabel labelEnablePrivacy; GraphicCheckBox checkBoxEnablePrivacy; diff --git a/source/glest_game/network/network_manager.cpp b/source/glest_game/network/network_manager.cpp index ae30edcb..e91029b1 100644 --- a/source/glest_game/network/network_manager.cpp +++ b/source/glest_game/network/network_manager.cpp @@ -35,7 +35,7 @@ NetworkManager::NetworkManager() { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] this->networkRole = %d gameNetworkInterface [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->networkRole,gameNetworkInterface); } -void NetworkManager::init(NetworkRole networkRole) { +void NetworkManager::init(NetworkRole networkRole, bool publishEnabled) { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] this->networkRole = %d, networkRole = %d, gameNetworkInterface [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->networkRole,networkRole,gameNetworkInterface); assert(gameNetworkInterface==NULL); @@ -44,7 +44,7 @@ void NetworkManager::init(NetworkRole networkRole) { if(networkRole == nrServer) { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] this->networkRole = %d, networkRole = %d, gameNetworkInterface [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->networkRole,networkRole,gameNetworkInterface); - gameNetworkInterface = new ServerInterface(); + gameNetworkInterface = new ServerInterface(publishEnabled); } else { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] this->networkRole = %d, networkRole = %d, gameNetworkInterface [%p]\n",__FILE__,__FUNCTION__,__LINE__,this->networkRole,networkRole,gameNetworkInterface); diff --git a/source/glest_game/network/network_manager.h b/source/glest_game/network/network_manager.h index 2ab5d414..d7fe04f7 100644 --- a/source/glest_game/network/network_manager.h +++ b/source/glest_game/network/network_manager.h @@ -37,7 +37,7 @@ public: static NetworkManager &getInstance(); NetworkManager(); - void init(NetworkRole networkRole); + void init(NetworkRole networkRole,bool publishEnabled=false); void end(); void update(); diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index 86822d65..bc0c31a3 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -41,7 +41,7 @@ double MAX_CLIENT_WAIT_SECONDS_FOR_PAUSE = 2; const int MAX_SLOT_THREAD_WAIT_TIME = 3; const int MASTERSERVER_HEARTBEAT_GAME_STATUS_SECONDS = 30; -ServerInterface::ServerInterface() :GameNetworkInterface() { +ServerInterface::ServerInterface(bool publishEnabled) :GameNetworkInterface() { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); nextEventId = 1; @@ -105,13 +105,25 @@ ServerInterface::ServerInterface() :GameNetworkInterface() { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); int portNumber = Config::getInstance().getInt("FTPServerPort",intToStr(ServerSocket::getFTPServerPort()).c_str()); ServerSocket::setFTPServerPort(portNumber); + + bool allowInternetTilesetFileTransfers = Config::getInstance().getBool("EnableFTPServerInternetTilesetXfer","true"); + bool allowInternetTechtreeFileTransfers = Config::getInstance().getBool("EnableFTPServerInternetTechtreeXfer","true"); + ftpServer = new FTPServerThread(mapsPath,tilesetsPath,techtreesPath, - portNumber,GameConstants::maxPlayers,this); + publishEnabled, + allowInternetTilesetFileTransfers, allowInternetTechtreeFileTransfers, + portNumber,GameConstants::maxPlayers,this); ftpServer->start(); } SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } +void ServerInterface::setPublishEnabled(bool value) { + if(ftpServer != NULL) { + ftpServer->setInternetEnabled(value); + } +} + ServerInterface::~ServerInterface() { SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); exitServer = true; diff --git a/source/glest_game/network/server_interface.h b/source/glest_game/network/server_interface.h index 0570cdf7..4aa0feee 100644 --- a/source/glest_game/network/server_interface.h +++ b/source/glest_game/network/server_interface.h @@ -74,7 +74,7 @@ private: bool inBroadcastMessage; public: - ServerInterface(); + ServerInterface(bool publishEnabled); virtual ~ServerInterface(); virtual Socket* getSocket() {return &serverSocket;} @@ -157,6 +157,8 @@ public: needToRepublishToMasterserver = value; } + void setPublishEnabled(bool value); + public: Mutex *getServerSynchAccessor() { return &serverSynchAccessor; @@ -165,6 +167,7 @@ public: virtual void simpleTask(BaseThread *callingThread); void addClientToServerIPAddress(uint32 clientIp, uint32 ServerIp); virtual int isValidClientType(uint32 clientIp); + private: void broadcastMessage(const NetworkMessage *networkMessage, int excludeSlot = -1, int lockedSlotIndex = -1); void broadcastMessageToConnectedClients(const NetworkMessage *networkMessage, int excludeSlot = -1); diff --git a/source/shared_lib/include/feathery_ftp/ftpIfc.h b/source/shared_lib/include/feathery_ftp/ftpIfc.h index f8794bea..cf245e5b 100644 --- a/source/shared_lib/include/feathery_ftp/ftpIfc.h +++ b/source/shared_lib/include/feathery_ftp/ftpIfc.h @@ -40,6 +40,7 @@ extern "C" { void ftpInit(ftpFindExternalFTPServerIpType cb1, ftpAddUPNPPortForwardType cb2, ftpRemoveUPNPPortForwardType cb3, ftpIsValidClientType cb4); int ftpCreateAccount(const char* name, const char* passw, const char* root, int accRights); +int ftpDeleteAccount(const char* name); int ftpStart(int portNumber); int ftpShutdown(void); int ftpExecute(void); diff --git a/source/shared_lib/include/platform/posix/miniftpserver.h b/source/shared_lib/include/platform/posix/miniftpserver.h index beb343fc..5316ee03 100644 --- a/source/shared_lib/include/platform/posix/miniftpserver.h +++ b/source/shared_lib/include/platform/posix/miniftpserver.h @@ -39,16 +39,23 @@ protected: int maxPlayers; static FTPClientValidationInterface *ftpValidationIntf; + bool internetEnabled; + bool allowInternetTilesetFileTransfers; + bool allowInternetTechtreeFileTransfers; + public: FTPServerThread(std::pair mapsPath, std::pair tilesetsPath, std::pair techtreesPath, + bool internetEnabledFlag, + bool allowInternetTilesetFileTransfers, bool allowInternetTechtreeFileTransfers, int portNumber,int maxPlayers, FTPClientValidationInterface *ftpValidationIntf); ~FTPServerThread(); virtual void execute(); virtual void signalQuit(); virtual bool shutdownAndWait(); + void setInternetEnabled(bool value, bool forceChange=false); static void addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp); static FTPClientValidationInterface * getFtpValidationIntf() { return ftpValidationIntf; } diff --git a/source/shared_lib/sources/feathery_ftp/ftpAccount.c b/source/shared_lib/sources/feathery_ftp/ftpAccount.c index 04c3ae05..2bf59bd1 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpAccount.c +++ b/source/shared_lib/sources/feathery_ftp/ftpAccount.c @@ -48,6 +48,21 @@ typedef struct */ LOCAL ftpUserAccount_S ftpUsers[MAX_USERS]; + +int ftpDeleteAccount(const char* name) +{ + int n; + + n = ftpFindAccount(name); // check if account already exists + if(n > 0) + { + ftpUsers[n - 1].name[0] = '\0'; // delete account + return 0; + } + + return -1; +} + /** * @brief Creates a new user account * diff --git a/source/shared_lib/sources/platform/posix/miniftpserver.cpp b/source/shared_lib/sources/platform/posix/miniftpserver.cpp index 3dd39682..9b4965db 100644 --- a/source/shared_lib/sources/platform/posix/miniftpserver.cpp +++ b/source/shared_lib/sources/platform/posix/miniftpserver.cpp @@ -48,11 +48,16 @@ int isValidClientType(ip_t clientIp) { FTPServerThread::FTPServerThread(std::pair mapsPath, std::pair tilesetsPath, std::pair techtreesPath, + bool internetEnabledFlag, + bool allowInternetTilesetFileTransfers, bool allowInternetTechtreeFileTransfers, int portNumber, int maxPlayers, FTPClientValidationInterface *ftpValidationIntf) : BaseThread() { this->mapsPath = mapsPath; this->tilesetsPath = tilesetsPath; this->techtreesPath = techtreesPath; + setInternetEnabled(internetEnabledFlag,true); + this->allowInternetTilesetFileTransfers = allowInternetTilesetFileTransfers; + this->allowInternetTechtreeFileTransfers = allowInternetTechtreeFileTransfers; this->portNumber = portNumber; this->maxPlayers = maxPlayers; this->ftpValidationIntf = ftpValidationIntf; @@ -94,6 +99,79 @@ void FTPServerThread::addClientToServerIPAddress(uint32 clientIp,uint32 ServerIp SystemFlags::OutputDebug(SystemFlags::debugNetwork,"===> FTP Server thread clientIp = %u, ServerIp = %u\n",clientIp,ServerIp); } +void FTPServerThread::setInternetEnabled(bool value, bool forceChange) { + if(forceChange == true || this->internetEnabled != value) { + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, changing InternetEnabled = %d\n",value); + + this->internetEnabled = value; + if(this->internetEnabled == true) { + // Setup FTP Users and permissions for tilesets + if(this->allowInternetTilesetFileTransfers == true) { + if(tilesetsPath.first != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetsPath #1 [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetsPath.first.c_str()); + ftpCreateAccount("tilesets", "mg_ftp_server", tilesetsPath.first.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + if(tilesetsPath.second != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetsPath #2 [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetsPath.second.c_str()); + ftpCreateAccount("tilesets_custom", "mg_ftp_server", tilesetsPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, tilesets users created\n"); + } + else { + ftpDeleteAccount("tilesets"); + ftpDeleteAccount("tilesets_custom"); + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, tilesets users deleted\n"); + } + + if(this->allowInternetTechtreeFileTransfers == true) { + // Setup FTP Users and permissions for tilesets + if(techtreesPath.first != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] techtreesPath #1 [%s]\n",__FILE__,__FUNCTION__,__LINE__,techtreesPath.first.c_str()); + ftpCreateAccount("techtrees", "mg_ftp_server", techtreesPath.first.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + if(techtreesPath.second != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] techtreesPath #2 [%s]\n",__FILE__,__FUNCTION__,__LINE__,techtreesPath.second.c_str()); + ftpCreateAccount("techtrees_custom", "mg_ftp_server", techtreesPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, techtrees users created\n"); + } + else { + ftpDeleteAccount("techtrees"); + ftpDeleteAccount("techtrees_custom"); + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, techtrees users deleted\n"); + } + } + else { + if(tilesetsPath.first != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetsPath #1 [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetsPath.first.c_str()); + ftpCreateAccount("tilesets", "mg_ftp_server", tilesetsPath.first.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + if(tilesetsPath.second != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetsPath #2 [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetsPath.second.c_str()); + ftpCreateAccount("tilesets_custom", "mg_ftp_server", tilesetsPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, tilesets users created\n"); + + // Setup FTP Users and permissions for tilesets + if(techtreesPath.first != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] techtreesPath #1 [%s]\n",__FILE__,__FUNCTION__,__LINE__,techtreesPath.first.c_str()); + ftpCreateAccount("techtrees", "mg_ftp_server", techtreesPath.first.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + if(techtreesPath.second != "") { + SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] techtreesPath #2 [%s]\n",__FILE__,__FUNCTION__,__LINE__,techtreesPath.second.c_str()); + ftpCreateAccount("techtrees_custom", "mg_ftp_server", techtreesPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); + } + + if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("===> FTP Server thread, techtrees users created\n"); + } + } +} + void FTPServerThread::execute() { { RunningStatusSafeWrapper runningStatus(this); @@ -119,26 +197,6 @@ void FTPServerThread::execute() { ftpCreateAccount("maps_custom", "mg_ftp_server", mapsPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); } - // Setup FTP Users and permissions for tilesets - if(tilesetsPath.first != "") { - SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetsPath #1 [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetsPath.first.c_str()); - ftpCreateAccount("tilesets", "mg_ftp_server", tilesetsPath.first.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); - } - if(tilesetsPath.second != "") { - SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] tilesetsPath #2 [%s]\n",__FILE__,__FUNCTION__,__LINE__,tilesetsPath.second.c_str()); - ftpCreateAccount("tilesets_custom", "mg_ftp_server", tilesetsPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); - } - - // Setup FTP Users and permissions for tilesets - if(techtreesPath.first != "") { - SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] techtreesPath #1 [%s]\n",__FILE__,__FUNCTION__,__LINE__,techtreesPath.first.c_str()); - ftpCreateAccount("techtrees", "mg_ftp_server", techtreesPath.first.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); - } - if(techtreesPath.second != "") { - SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] techtreesPath #2 [%s]\n",__FILE__,__FUNCTION__,__LINE__,techtreesPath.second.c_str()); - ftpCreateAccount("techtrees_custom", "mg_ftp_server", techtreesPath.second.c_str(), FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); - } - /* ftpCreateAccount("anonymous", "", "./", FTP_ACC_RD | FTP_ACC_LS | FTP_ACC_DIR); ftpCreateAccount("nothing", "", "./", 0);