diff --git a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp index 3e9aa766..afb9e7f5 100755 --- a/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/ConnectionServer/src/shared/ClientConnection.cpp @@ -468,8 +468,10 @@ ClientConnection::onIdValidated(bool canLogin, bool canCreateRegularCharacter, b m_consumedRewardEvents = consumedRewardEvents; m_claimedRewardItems = claimedRewardItems; - int level = AdminAccountManager::isAdminAccount(getSUID(), ConfigConnectionServer::getUseOldSuidGenerator()); - if (level != 0)) // Note: not checking IP, so that owners of god accounts can create characters to play from home without having to erase the characters they use for work + + int level = 0; + if (AdminAccountManager::isAdminAccount(Unicode::toLower(getAccountName()), level) && (level != + 0)) // Note: not checking IP, so that owners of god accounts can create characters to play from home without having to erase the characters they use for work { canLogin = true; canCreateRegularCharacter = true; @@ -1413,8 +1415,8 @@ ClientConnection::onValidateClient(StationId suid, const std::string &username, LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but was not logging in from an internal IP", username.c_str(), suid, m_requestedSuid)); } else { - int adminLevel = AdminAccountManager::isAdminAccount(getSUID(), ConfigConnectionServer::getUseOldSuidGenerator()); - if (adminLevel < 10) { + int adminLevel = 0; + if (!AdminAccountManager::isAdminAccount(Unicode::toLower(username), adminLevel) || adminLevel < 10) { LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but did not have sufficient permissions", username.c_str(), suid, m_requestedSuid)); } else { diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 7ed0c7a9..1b311351 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -203,8 +203,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string & if (msg.empty()) { msg = "Invalid username or password."; } - - ErrorMessage err("Login Failed", msg); + + ErrorMessage err("Login Failed", msg); this->send(err, true); } } else { @@ -224,9 +224,11 @@ void ClientConnection::validateClient(const std::string &id, const std::string & user_id = std::hash{}(uname.c_str()); } - m_stationId = user_id; + if (authOK) { - if (authOK && !testMode) { + m_stationId = user_id; + + if (!testMode) { REPORT_LOG(true, ("Client connected. Username: %s (%i) \n", uname.c_str(), user_id)); if (!parentAccount.empty()) { @@ -260,7 +262,6 @@ void ClientConnection::validateClient(const std::string &id, const std::string & WARNING(true, ("Login API returned empty child account(s).")); } } - } LOG("LoginClientConnection", ("validateClient() for stationId (%i) at IP (%s), id (%s)", user_id, getRemoteAddress().c_str(), uname.c_str())); diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index e29ab00c..342a2dfb 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -12,6 +12,7 @@ #include "ClientConnection.h" #include "ConfigLoginServer.h" #include "ConsoleManager.h" +#include "CSToolConnection.h" #include "DatabaseConnection.h" #ifdef _DEBUG @@ -146,6 +147,12 @@ LoginServer::LoginServer() m_centralService = new Service(ConnectionAllocator(), setup); } + // only start the customer tool connection listener if the port is set (defaults to 0) + setup.port = ConfigLoginServer::getCSToolPort(); + if (setup.port) { + m_CSService = new Service(ConnectionAllocator(), setup); + } + // set up message connections connectToMessage("ClaimRewardsMessage"); connectToMessage("ConnectionClosed"); @@ -1221,9 +1228,10 @@ LoginServer::onValidateClient(StationId suid, const std::string &username, Clien NOT_NULL(conn); WARNING_STRICT_FATAL(getValidatedClient(suid), ("Validating an already valid client in onValidateClient(). StationId: %d UserName: %s", suid, username.c_str())); - int adminLevel = AdminAccountManager::isAdminAccount(suid, ConfigLoginServer::getUseOldSuidGenerator()); + int adminLevel = 0; + const bool isAdminAccount = AdminAccountManager::isAdminAccount(Unicode::toLower(username), adminLevel); - if (adminLevel > 0 && conn->getRequestedAdminSuid() != 0) { + if (conn->getRequestedAdminSuid() != 0) { //verify internal, secure, is on the god list bool loginOK = false; if (!isSecure) { @@ -1232,7 +1240,7 @@ LoginServer::onValidateClient(StationId suid, const std::string &username, Clien if (!AdminAccountManager::isInternalIp(conn->getRemoteAddress())) { LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but was not logging in from an internal IP", username.c_str(), suid, conn->getRequestedAdminSuid())); } else { - if (adminLevel < 10) { + if (!isAdminAccount || adminLevel < 10) { LOG("CustomerService", ("AdminLogin: User %s (account %li) attempted to log into account %li, but did not have sufficient permissions", username.c_str(), suid, conn->getRequestedAdminSuid())); } else { suid = conn->getRequestedAdminSuid(); @@ -1323,7 +1331,7 @@ LoginServer::onValidateClient(StationId suid, const std::string &username, Clien conn->setIsValidated(true); conn->setStationId(suid); conn->setIsSecure(isSecure); - conn->setAdminLevel((adminLevel > 0) ? adminLevel : -1); + conn->setAdminLevel(isAdminAccount ? adminLevel : -1); IGNORE_RETURN(m_validatedClientMap.insert(std::pair(suid, conn))); //Must be done after setting various information in the connection object above diff --git a/engine/server/library/serverGame/src/shared/core/Client.cpp b/engine/server/library/serverGame/src/shared/core/Client.cpp index 144b3be8..e34549ec 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.cpp +++ b/engine/server/library/serverGame/src/shared/core/Client.cpp @@ -209,9 +209,8 @@ Client::Client(ConnectionServerConnection &connection, const NetworkId &characte connectToEmitter(connection, "ConnectionServerConnectionDestroyed"); // Check god permissions - int adminLevel = AdminAccountManager::isAdminAccount(stationId, ConfigServerGame::getUseOldSuidGenerator()); if (ConfigServerGame::getAdminGodToAll() || ((!ConfigServerGame::getUseSecureLoginForGodAccess() || m_isSecure) && - (adminLevel > 0) && + AdminAccountManager::isAdminAccount(Unicode::toLower(accountName), m_godLevel) && (!ConfigServerGame::getUseIPForGodAccess() || AdminAccountManager::isInternalIp(ipAddr)))) { m_godValidated = true; diff --git a/engine/server/library/serverGame/src/shared/core/Client.h b/engine/server/library/serverGame/src/shared/core/Client.h index 87bcaab2..bbfce949 100755 --- a/engine/server/library/serverGame/src/shared/core/Client.h +++ b/engine/server/library/serverGame/src/shared/core/Client.h @@ -2,8 +2,8 @@ // copyright 2000 Verant Interactive -#ifndef _CLIENT_H -#define _CLIENT_H +#ifndef _CLIENT_H +#define _CLIENT_H //----------------------------------------------------------------------- @@ -23,489 +23,448 @@ #include class ConnectionServerConnection; - class GameNetworkMessage; - class CreatureObject; - class ObjectList; - class PlayerObject; - class ServerObject; - class TangibleObject; - struct ClientDestroy; //----------------------------------------------------------------------- -class Client : public MessageDispatch::Receiver, public MessageDispatch::Emitter { - friend class ClientChannel; - +class Client : public MessageDispatch::Receiver, public MessageDispatch::Emitter +{ + friend class ClientChannel; public: - typedef std::map AccountFeatureIdList; - - Client(ConnectionServerConnection &connection, const NetworkId &characterObjectId, const std::string &accountName, const std::string &ipAddr, bool isSecure, bool isSkipLoadScreen, unsigned int stationId, std::set const &observedObjects, uint32 gameFeatures, uint32 subscriptionFeatures, AccountFeatureIdList const &accountFeatureIds, unsigned int entitlementTotalTime, unsigned int entitlementEntitledTime, unsigned int entitlementTotalTimeSinceLastLogin, unsigned int entitlementEntitledTimeSinceLastLogin, int buddyPoints, std::vector > const &consumedRewardEvents, std::vector > const &claimedRewardItems, bool usingAdminLogin, CombatDataTable::CombatSpamFilterType combatSpamFilter, int combatSpamRangeSquaredFilter, int furnitureRotationDegree, bool hasUnoccupiedJediSlot, bool isJediSlotCharacter, bool sendToStarport = false); - - virtual ~Client(); - - static void install(); - - void addControlledObject(ServerObject &object); - - void clearControlledObjects(); - - ServerObject *findControlledObject(NetworkId const &id) const; - - std::vector const &getControlledObjects() const; - - const Unicode::String &getCharacterName() const; //@todo is this used? - const std::string &getIpAddress() const; - - ServerObject *getCharacterObject() const; - - const NetworkId &getCharacterObjectId() const; - - const std::string &getAccountName() const; - - const unsigned int getStationId() const; - - uint32 getGameFeatures() const; - - uint32 getSubscriptionFeatures() const; - - AccountFeatureIdList const &getAccountFeatureIds() const; - - void setAccountFeatureIds(AccountFeatureIdList const &accountFeatureIds); - - void setAccountFeatureId(uint32 featureId, int count); - - unsigned int getEntitlementTotalTime() const; - - unsigned int getEntitlementEntitledTime() const; - - unsigned int getEntitlementTotalTimeSinceLastLogin() const; - - unsigned int getEntitlementEntitledTimeSinceLastLogin() const; - - bool isFreeTrialAccount() const; - - int getBuddyPoints() const; - - bool isSecure() const; - - std::vector > const &getConsumedRewardEvents() const; - - std::vector > const &getClaimedRewardItems() const; - - bool isUsingAdminLogin() const; - - CombatDataTable::CombatSpamFilterType getCombatSpamFilter() const; - - int getCombatSpamRangeSquaredFilter() const; - - bool - shouldReceiveCombatSpam(NetworkId const &attacker, Vector const &attackerPosition_w, NetworkId const &defender, Vector const &defenderPosition_w) const; - - int getFurnitureRotationDegree() const; - - bool getHasUnoccupiedJediSlot() const; - - bool getIsJediSlotCharacter() const; - - bool getSendToStarport() const; - - ConnectionServerConnection *getConnection(); - - // sync stamp for dealing with times synced to our connection server - uint16 getServerSyncStampShort() const; - - uint32 getServerSyncStampLong() const; - - float computeDeltaTimeInSeconds(uint32 syncStampLong) const; - - WatchedByList &getWatchedByList() const; - - int getConnectionServerLag() const; - - int getGameServerLag() const; - - MessageDispatch::Transceiver &getDestroyNotifier(); - - bool getIsReady() const; - - bool isControlled(NetworkId const &id) const; - - bool isGod() const; - - int getGodLevel() const; - - bool isGodValidated() const; - - void onLoadPlayer(CreatureObject &newCharacter); - - void assumeControl(CreatureObject &newCharacter); - - void addSynchronizedUi(ServerSynchronizedUi *sync); - - void removeSynchronizedUi(ServerSynchronizedUi const *sync); - - void receiveClientMessage(const GameNetworkMessage &message); - - void receiveMessage(const MessageDispatch::Emitter &source, const MessageDispatch::MessageBase &message); - - void removeControlledObject(ServerObject &object); - - void selfDestruct(); - - void selfDestruct(const bool immediate); - - /** send() sends a message to the client via the connection server. - */ - void send(const GameNetworkMessage &outgoingMessage, bool reliable) const; - - void sendToConnectionServer(const GameNetworkMessage &outgoingMessage); - - bool setGodMode(bool status); - - struct ServerObjectPointerHash { - size_t operator()(ServerObject *const ptr) const { - return (reinterpret_cast(ptr) >> 4); - }; - }; - - struct TangibleObjectPointerHash { - size_t operator()(TangibleObject *const ptr) const { - return (reinterpret_cast(ptr) >> 4); - }; - }; - - typedef std::unordered_set ObservingList; - - // objects being observed that are in this list needs - // to have their pvp status updated when there are changes - // that requires pvp status to be recalcuclated - typedef std::unordered_set ObservingListPvpSync; - - ObservingList const &getObserving() const; - - ObservingListPvpSync const &getObservingPvpSync() const; - - void addObserving(ServerObject *o); - - void addObservingPvpSync(TangibleObject *to); - - void removeObserving(ServerObject *o); - - void removeObservingPvpSync(ServerObject *o); - - void removeAllObserving(); - - std::set &getOpenedContainers(); - - std::set const &getOpenedContainers() const; - - void resetIdleTimeAfterCharacterTransfer(); - - void resetIdleTime(); - - bool idledTooLong() const; - - void handleIdleDisconnect() const; - - void openContainer(ServerObject &obj, int sequence, std::string const &slotDesc); - - void closeContainer(ServerObject &obj); - - void observeContainer(ServerObject &obj, int sequence, std::string const &slotDesc); - - void launchWebBrowser(std::string const &url) const; - - class ClientMessage : public MessageDispatch::MessageBase { - public: - ClientMessage(const std::string &message); - - ~ClientMessage(); - - private: - ClientMessage(); - - ClientMessage(const ClientMessage &source); - - ClientMessage &operator=(const ClientMessage &rhs); - }; - - static std::map &getPacketBytesPerMinStats(); + typedef std::map AccountFeatureIdList; + + Client (ConnectionServerConnection & connection, const NetworkId & characterObjectId, const std::string& accountName, const std::string& ipAddr, bool isSecure, bool isSkipLoadScreen, unsigned int stationId, std::set const & observedObjects, uint32 gameFeatures, uint32 subscriptionFeatures, AccountFeatureIdList const & accountFeatureIds, unsigned int entitlementTotalTime, unsigned int entitlementEntitledTime, unsigned int entitlementTotalTimeSinceLastLogin, unsigned int entitlementEntitledTimeSinceLastLogin, int buddyPoints, std::vector > const & consumedRewardEvents, std::vector > const & claimedRewardItems, bool usingAdminLogin, CombatDataTable::CombatSpamFilterType combatSpamFilter, int combatSpamRangeSquaredFilter, int furnitureRotationDegree, bool hasUnoccupiedJediSlot, bool isJediSlotCharacter, bool sendToStarport = false); + virtual ~Client (); + + static void install(); + + void addControlledObject (ServerObject &object); + void clearControlledObjects (); + ServerObject * findControlledObject (NetworkId const &id) const; + std::vector const &getControlledObjects() const; + const Unicode::String & getCharacterName () const; //@todo is this used? + const std::string & getIpAddress () const; + ServerObject* getCharacterObject () const; + const NetworkId & getCharacterObjectId () const; + const std::string & getAccountName () const; + const unsigned int getStationId () const; + uint32 getGameFeatures() const; + uint32 getSubscriptionFeatures() const; + AccountFeatureIdList const & getAccountFeatureIds() const; + void setAccountFeatureIds(AccountFeatureIdList const & accountFeatureIds); + void setAccountFeatureId(uint32 featureId, int count); + unsigned int getEntitlementTotalTime () const; + unsigned int getEntitlementEntitledTime () const; + unsigned int getEntitlementTotalTimeSinceLastLogin () const; + unsigned int getEntitlementEntitledTimeSinceLastLogin () const; + bool isFreeTrialAccount() const; + int getBuddyPoints() const; + bool isSecure() const; + std::vector > const & getConsumedRewardEvents() const; + std::vector > const & getClaimedRewardItems() const; + bool isUsingAdminLogin() const; + CombatDataTable::CombatSpamFilterType getCombatSpamFilter() const; + int getCombatSpamRangeSquaredFilter() const; + bool shouldReceiveCombatSpam(NetworkId const & attacker, Vector const & attackerPosition_w, NetworkId const & defender, Vector const & defenderPosition_w) const; + int getFurnitureRotationDegree() const; + bool getHasUnoccupiedJediSlot() const; + bool getIsJediSlotCharacter() const; + + bool getSendToStarport() const; + + ConnectionServerConnection * getConnection (); + // sync stamp for dealing with times synced to our connection server + uint16 getServerSyncStampShort () const; + uint32 getServerSyncStampLong () const; + float computeDeltaTimeInSeconds(uint32 syncStampLong) const; + WatchedByList & getWatchedByList () const; + + int getConnectionServerLag () const; + int getGameServerLag () const; + + MessageDispatch::Transceiver & getDestroyNotifier(); + + bool getIsReady () const; + bool isControlled (NetworkId const &id) const; + bool isGod() const; + int getGodLevel() const; + bool isGodValidated() const; + + void onLoadPlayer (CreatureObject &newCharacter); + void assumeControl (CreatureObject &newCharacter); + + void addSynchronizedUi (ServerSynchronizedUi * sync); + void removeSynchronizedUi (ServerSynchronizedUi const * sync); + + void receiveClientMessage (const GameNetworkMessage & message); + void receiveMessage (const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message); + void removeControlledObject (ServerObject &object); + void selfDestruct (); + void selfDestruct (const bool immediate); + /** send() sends a message to the client via the connection server. + */ + void send (const GameNetworkMessage & outgoingMessage, bool reliable) const; + void sendToConnectionServer (const GameNetworkMessage & outgoingMessage); + bool setGodMode(bool status); + + struct ServerObjectPointerHash + { + size_t operator()(ServerObject * const ptr) const + { + return (reinterpret_cast(ptr) >> 4); + }; + }; + struct TangibleObjectPointerHash + { + size_t operator()(TangibleObject * const ptr) const + { + return (reinterpret_cast(ptr) >> 4); + }; + }; + typedef std::unordered_set ObservingList; + + // objects being observed that are in this list needs + // to have their pvp status updated when there are changes + // that requires pvp status to be recalcuclated + typedef std::unordered_set ObservingListPvpSync; + + ObservingList const & getObserving() const; + ObservingListPvpSync const & getObservingPvpSync() const; + void addObserving(ServerObject* o); + void addObservingPvpSync(TangibleObject* to); + void removeObserving(ServerObject* o); + void removeObservingPvpSync(ServerObject* o); + void removeAllObserving(); + + std::set & getOpenedContainers(); + std::set const &getOpenedContainers() const; + + void resetIdleTimeAfterCharacterTransfer(); + void resetIdleTime(); + bool idledTooLong() const; + void handleIdleDisconnect() const; + + void openContainer(ServerObject &obj, int sequence, std::string const &slotDesc); + void closeContainer(ServerObject &obj); + void observeContainer(ServerObject &obj, int sequence, std::string const &slotDesc); + + void launchWebBrowser(std::string const & url) const; + + class ClientMessage : public MessageDispatch::MessageBase + { + public: + ClientMessage(const std::string & message); + ~ClientMessage(); + private: + ClientMessage(); + ClientMessage(const ClientMessage & source); + ClientMessage & operator = (const ClientMessage & rhs); + }; + + static std::map< std::string, uint32 >& getPacketBytesPerMinStats(); private: - Client(const Client &); - - Client &operator=(const Client &); - + Client(const Client&); + Client& operator=(const Client&); + private: - std::string m_accountName; - Unicode::String m_characterName; - NetworkId m_characterObjectId; - ConnectionServerConnection *m_connection; - std::vector m_controlledObjects; - int m_godLevel; - bool m_godMode; - bool m_godValidated; - std::string m_ipAddress; - bool m_isReady; - bool m_isSecure; - bool m_isSkipLoadScreen; - CachedNetworkId m_primaryControlledObject; // This will be the creature object representing the player (or possibly a vehicle in the future) - MessageDispatch::Transceiver destroyNotifier; + std::string m_accountName; + Unicode::String m_characterName; + NetworkId m_characterObjectId; + ConnectionServerConnection * m_connection; + std::vector m_controlledObjects; + int m_godLevel; + bool m_godMode; + bool m_godValidated; + std::string m_ipAddress; + bool m_isReady; + bool m_isSecure; + bool m_isSkipLoadScreen; + CachedNetworkId m_primaryControlledObject; // This will be the creature object representing the player (or possibly a vehicle in the future) + MessageDispatch::Transceiver destroyNotifier; - ObservingList m_observing; + ObservingList m_observing; - // for optimization, we keep the list of observed objects - // that needs to have their pvp status updated when there - // are changes that requires pvp status to be recalcuclated; - // this is so that we don't have to iterate over the - // entire list of observed objects (which can get pretty - // large) to find these particular observed objects - ObservingListPvpSync m_observingPvpSync; + // for optimization, we keep the list of observed objects + // that needs to have their pvp status updated when there + // are changes that requires pvp status to be recalcuclated; + // this is so that we don't have to iterate over the + // entire list of observed objects (which can get pretty + // large) to find these particular observed objects + ObservingListPvpSync m_observingPvpSync; - std::set m_openedContainers; - mutable WatchedByList m_watchedByList; - unsigned long m_lastNonIdleTime; - unsigned int m_stationId; - int m_connectionServerLag; - int m_gameServerLag; - uint32 m_gameFeatures; - uint32 m_subscriptionFeatures; - AccountFeatureIdList m_accountFeatureIds; - unsigned int m_entitlementTotalTime; - unsigned int m_entitlementEntitledTime; - unsigned int m_entitlementTotalTimeSinceLastLogin; - unsigned int m_entitlementEntitledTimeSinceLastLogin; - int m_buddyPoints; - std::set m_previousObservedObjects; - std::vector > m_syncUIs; - std::vector > m_consumedRewardEvents; - std::vector > m_claimedRewardItems; - bool m_usingAdminLogin; - CombatDataTable::CombatSpamFilterType m_combatSpamFilter; - int m_combatSpamRangeSquaredFilter; - int m_furnitureRotationDegree; + std::set m_openedContainers; + mutable WatchedByList m_watchedByList; + unsigned long m_lastNonIdleTime; + unsigned int m_stationId; + int m_connectionServerLag; + int m_gameServerLag; + uint32 m_gameFeatures; + uint32 m_subscriptionFeatures; + AccountFeatureIdList m_accountFeatureIds; + unsigned int m_entitlementTotalTime; + unsigned int m_entitlementEntitledTime; + unsigned int m_entitlementTotalTimeSinceLastLogin; + unsigned int m_entitlementEntitledTimeSinceLastLogin; + int m_buddyPoints; + std::set m_previousObservedObjects; + std::vector > m_syncUIs; + std::vector > m_consumedRewardEvents; + std::vector > m_claimedRewardItems; + bool m_usingAdminLogin; + CombatDataTable::CombatSpamFilterType m_combatSpamFilter; + int m_combatSpamRangeSquaredFilter; + int m_furnitureRotationDegree; - // these 2 come from the client (via the LoginServer) so should not be trusted; - // we cache them here to do preliminary checks to avoid unnecessarily sending - // commands to the LoginServer (assuming the values haven't been hacked on the - // client); when we do send the commands to the LoginServer, we'll check again there - bool m_hasUnoccupiedJediSlot; - bool m_isJediSlotCharacter; + // these 2 come from the client (via the LoginServer) so should not be trusted; + // we cache them here to do preliminary checks to avoid unnecessarily sending + // commands to the LoginServer (assuming the values haven't been hacked on the + // client); when we do send the commands to the LoginServer, we'll check again there + bool m_hasUnoccupiedJediSlot; + bool m_isJediSlotCharacter; - bool m_sendToStarport; + bool m_sendToStarport; - static std::map sm_outgoingBytesMap_Working; // working stats that will rotate after 1 minute - static std::map sm_outgoingBytesMap_Stats; // computed stats from the last minute - static uint32 sm_outgoingBytesMap_Worktime; // time we started filling in the working map + static std::map< std::string, uint32 > sm_outgoingBytesMap_Working; // working stats that will rotate after 1 minute + static std::map< std::string, uint32 > sm_outgoingBytesMap_Stats; // computed stats from the last minute + static uint32 sm_outgoingBytesMap_Worktime; // time we started filling in the working map }; //----------------------------------------------------------------------- -struct ClientDestroy { - explicit ClientDestroy(Client *c) : client(c) { - }; - - ~ClientDestroy() {}; - Client *client; +struct ClientDestroy +{ + explicit ClientDestroy(Client * c) : + client(c) + { + }; + ~ClientDestroy() {}; + Client * client; }; //----------------------------------------------------------------------- -inline bool Client::isGodValidated() const { - return m_godValidated; +inline bool Client::isGodValidated() const +{ + return m_godValidated; } //----------------------------------------------------------------------- -inline const Unicode::String &Client::getCharacterName() const { - return m_characterName; +inline const Unicode::String & Client::getCharacterName() const +{ + return m_characterName; } //----------------------------------------------------------------------- -inline const NetworkId &Client::getCharacterObjectId() const { - return m_characterObjectId; +inline const NetworkId &Client::getCharacterObjectId() const +{ + return m_characterObjectId; } //----------------------------------------------------------------------- -inline ServerObject *Client::getCharacterObject() const { - return findControlledObject(getCharacterObjectId()); +inline ServerObject* Client::getCharacterObject() const +{ + return findControlledObject(getCharacterObjectId()); } //----------------------------------------------------------------------- -inline ConnectionServerConnection *Client::getConnection() { - return m_connection; +inline ConnectionServerConnection * Client::getConnection() +{ + return m_connection; } //----------------------------------------------------------------------- -inline MessageDispatch::Transceiver &Client::getDestroyNotifier() { - return destroyNotifier; +inline MessageDispatch::Transceiver & Client::getDestroyNotifier() +{ + return destroyNotifier; } //----------------------------------------------------------------------- -inline bool Client::getIsReady() const { +inline bool Client::getIsReady() const +{ return m_isReady; } //----------------------------------------------------------------------- -inline bool Client::isGod() const { - if (AdminAccountManager::isAdminAccount(getStationId(), ConfigServerGame::getUseOldSuidGenerator()) > 0) { - return true; - } - return false; +inline bool Client::isGod() const +{ + return m_godMode; } //----------------------------------------------------------------------- -inline int Client::getGodLevel() const { - return m_godLevel; +inline int Client::getGodLevel() const +{ + return m_godLevel; } //----------------------------------------------------------------------- -inline Client::ObservingList const &Client::getObserving() const { - return m_observing; +inline Client::ObservingList const &Client::getObserving() const +{ + return m_observing; } //----------------------------------------------------------------------- -inline Client::ObservingListPvpSync const &Client::getObservingPvpSync() const { - return m_observingPvpSync; +inline Client::ObservingListPvpSync const &Client::getObservingPvpSync() const +{ + return m_observingPvpSync; } //----------------------------------------------------------------------- -inline void Client::removeObserving(ServerObject *o) { - if (o) { - IGNORE_RETURN(m_observing.erase(o)); - removeObservingPvpSync(o); - } +inline void Client::removeObserving(ServerObject* o) +{ + if (o) + { + IGNORE_RETURN(m_observing.erase(o)); + removeObservingPvpSync(o); + } } //----------------------------------------------------------------------- -inline void Client::removeAllObserving() { - m_observing.clear(); - m_observingPvpSync.clear(); +inline void Client::removeAllObserving() +{ + m_observing.clear(); + m_observingPvpSync.clear(); } //----------------------------------------------------------------------- -inline std::set &Client::getOpenedContainers() { - return m_openedContainers; +inline std::set &Client::getOpenedContainers() +{ + return m_openedContainers; } //----------------------------------------------------------------------- -inline std::set const &Client::getOpenedContainers() const { - return m_openedContainers; +inline std::set const &Client::getOpenedContainers() const +{ + return m_openedContainers; } //----------------------------------------------------------------------- -inline WatchedByList &Client::getWatchedByList() const { - return m_watchedByList; +inline WatchedByList & Client::getWatchedByList() const +{ + return m_watchedByList; } //----------------------------------------------------------------------- -inline uint32 Client::getGameFeatures() const { - return m_gameFeatures; +inline uint32 Client::getGameFeatures() const +{ + return m_gameFeatures; } //----------------------------------------------------------------------- -inline uint32 Client::getSubscriptionFeatures() const { - return m_subscriptionFeatures; +inline uint32 Client::getSubscriptionFeatures() const +{ + return m_subscriptionFeatures; } //----------------------------------------------------------------------- -inline Client::AccountFeatureIdList const &Client::getAccountFeatureIds() const { - return m_accountFeatureIds; +inline Client::AccountFeatureIdList const & Client::getAccountFeatureIds() const +{ + return m_accountFeatureIds; } //----------------------------------------------------------------------- -inline void Client::setAccountFeatureIds(AccountFeatureIdList const &accountFeatureIds) { - m_accountFeatureIds = accountFeatureIds; +inline void Client::setAccountFeatureIds(AccountFeatureIdList const & accountFeatureIds) +{ + m_accountFeatureIds = accountFeatureIds; } //----------------------------------------------------------------------- -inline void Client::setAccountFeatureId(uint32 featureId, int count) { - if (count > 0) { - m_accountFeatureIds[featureId] = count; - } else { - IGNORE_RETURN(m_accountFeatureIds.erase(featureId)); - } +inline void Client::setAccountFeatureId(uint32 featureId, int count) +{ + if (count > 0) + m_accountFeatureIds[featureId] = count; + else + IGNORE_RETURN(m_accountFeatureIds.erase(featureId)); } // ---------------------------------------------------------------------- -inline unsigned int Client::getEntitlementTotalTime() const { - return m_entitlementTotalTime; +inline unsigned int Client::getEntitlementTotalTime() const +{ + return m_entitlementTotalTime; } // ---------------------------------------------------------------------- -inline unsigned int Client::getEntitlementEntitledTime() const { - return m_entitlementEntitledTime; +inline unsigned int Client::getEntitlementEntitledTime() const +{ + return m_entitlementEntitledTime; } // ---------------------------------------------------------------------- -inline unsigned int Client::getEntitlementTotalTimeSinceLastLogin() const { - return m_entitlementTotalTimeSinceLastLogin; +inline unsigned int Client::getEntitlementTotalTimeSinceLastLogin() const +{ + return m_entitlementTotalTimeSinceLastLogin; } // ---------------------------------------------------------------------- -inline unsigned int Client::getEntitlementEntitledTimeSinceLastLogin() const { - return m_entitlementEntitledTimeSinceLastLogin; +inline unsigned int Client::getEntitlementEntitledTimeSinceLastLogin() const +{ + return m_entitlementEntitledTimeSinceLastLogin; } //----------------------------------------------------------------------- -inline CombatDataTable::CombatSpamFilterType Client::getCombatSpamFilter() const { - return m_combatSpamFilter; +inline CombatDataTable::CombatSpamFilterType Client::getCombatSpamFilter() const +{ + return m_combatSpamFilter; } //----------------------------------------------------------------------- -inline int Client::getCombatSpamRangeSquaredFilter() const { - return m_combatSpamRangeSquaredFilter; +inline int Client::getCombatSpamRangeSquaredFilter() const +{ + return m_combatSpamRangeSquaredFilter; } //----------------------------------------------------------------------- -inline int Client::getFurnitureRotationDegree() const { - return m_furnitureRotationDegree; +inline int Client::getFurnitureRotationDegree() const +{ + return m_furnitureRotationDegree; } //----------------------------------------------------------------------- -inline bool Client::getHasUnoccupiedJediSlot() const { - return m_hasUnoccupiedJediSlot; +inline bool Client::getHasUnoccupiedJediSlot() const +{ + return m_hasUnoccupiedJediSlot; } //----------------------------------------------------------------------- -inline bool Client::getIsJediSlotCharacter() const { - return m_isJediSlotCharacter; +inline bool Client::getIsJediSlotCharacter() const +{ + return m_isJediSlotCharacter; } //----------------------------------------------------------------------- diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp index cffd296e..5f66b597 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.cpp @@ -65,14 +65,16 @@ const std::string & AdminAccountManager::getAdminTagName() //----------------------------------------------------------------------- // if they are in the iff and have a level set, return it -int AdminAccountManager::isAdminAccount(int suid, bool useOldSuid) +int AdminAccountManager::isAdminAccount(uint32 suid, bool useOldSuid) { DEBUG_FATAL(!ms_installed, ("AdminAccountManager not installed")); + int columnNumber = -1; + if (!useOldSuid) { - int columnNumber = ms_adminTable->findColumnNumber("AdminSuid"); + columnNumber = ms_adminTable->findColumnNumber("AdminSuid"); } else { - int columnNumber = ms_adminTable->findColumnNumber("OldAdminSuid"); + columnNumber = ms_adminTable->findColumnNumber("OldAdminSuid"); } DEBUG_FATAL(columnNumber == -1, ("Error loading admin table...no account column")); diff --git a/engine/server/library/serverUtility/src/shared/AdminAccountManager.h b/engine/server/library/serverUtility/src/shared/AdminAccountManager.h index 0d02cc64..40ebd363 100755 --- a/engine/server/library/serverUtility/src/shared/AdminAccountManager.h +++ b/engine/server/library/serverUtility/src/shared/AdminAccountManager.h @@ -19,7 +19,7 @@ public: static const char *getAdminCommandName(); static const std::string & getAdminTagName(); - static int isAdminAccount(int suid, bool useOldSuid = false); + static int isAdminAccount(uint32 suid, bool useOldSuid = false); static bool isAdminAccount(const std::string & account, int& level); static bool isInternalIp(const std::string & addr); static void reload();