summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2023-05-26Fixed login in case an account gets two pending tokens assignedHEADmasterThorbjørn Lindeijer5-89/+33
Not entirely sure if this is what was happening, but if a PAMSG_LOGIN_RNDTRGR was handled, a new pending account was always created and appended to mPendingAccounts. However, when handling the follow-up PAMSG_LOGIN, only the first pending account with matching username was checked, which could result in a failed login due to mismatching token. Resolved this issue by unifying the client-specific random token with the Stellar token stored on the AccountClient. This means the username value in PAMSG_LOGIN_RNDTRGR could be removed. Eventually it would also be nice to simplify this further such that the token is automatically sent to the client after connecting rather than being something that needs to be requested.
2023-05-16Allow account email to be null in the databaseThorbjørn Lindeijer5-33/+106
When using login with Stellar, the email address remains empty. This was causing issues since the email is also required to be unique, in effect only a single Stellar account could exist. Resolved this by allowing the email column to be null, since the unique requirement does not cover null values. An empty email will now be stored as null value. For non-Stellar logins, an email address is still required.
2023-05-16Added error handling to SqLiteDataProvider::processSqlThorbjørn Lindeijer2-3/+13
Previously errors would just cause it to return an empty set.
2023-05-16Added some info messages related to Stellar loginThorbjørn Lindeijer3-2/+6
Something doesn't seem to be working right...
2023-05-15Manage CharacterData using std::unique_ptrThorbjørn Lindeijer16-198/+187
Fixes many memory leaks, but also made it clear that we're very often loading all the character data only to immediately throw it away again, even when most of the time all we really need is the database ID or the name.
2023-05-15General code cleanupsThorbjørn Lindeijer44-159/+145
* Overall includes cleanup * Use std::make_pair * Make some functions const
2023-05-05Added net_stellarLoginUrl configurationThorbjørn Lindeijer2-2/+5
The client needs to know the URL to open in the browser. The bare token is still sent as well, which might allow the client to directly interact with a Stellar wallet in the future.
2023-05-05Use std::make_uniqueThorbjørn Lindeijer2-10/+5
2023-05-05Avoid potential undefined behavior related to data raceThorbjørn Lindeijer1-3/+4
Using atomic operations to avoid a compiler potentially optimizing away the thread responsible for clean shutdown.
2023-05-05Added support for logging in with StellarThorbjørn Lindeijer10-72/+323
* Added PAMSG_STELLAR_LOGIN / PAMSG_STELLAR_LOGIN_RESPONSE, which is used by the client to request a login token that can be signed using a Stellar wallet. * Added uWebSockets dependency, used to listen for a separate server that verifies signed tokens (the Stellar Bridge). When a token is verified, it is sent to manaserv-account, which then sends a APMSG_LOGIN_RESPONSE to the client matching the token. * Added RapidJSON dependency to parse the JSON WebSocket messages. * To keep everything in a single thread, uWebSockets is now driving the event loop. Processing of ENet hosts, writing stats and expired bans have been moved to uSocket timers. * C++ standard updated to C++17, as required by uWebSockets. When Stellar is used to login, the public key is used as the username. It might be better to introduce an explicit field for this, especially when we want to enable an account to feature both Stellar login as well as login with username / password.
2023-05-02Fixed condition in compareStrIThorbjørn Lindeijer1-1/+1
The result of the first part of the condition, "itA < endA", was simply unused. Discovered thanks to attribute ‘nodiscard’ [-Wunused-result] in more recent C++ standard / compiler.
2023-05-01CMake: Use cmake-format to reformat all CMakeLists.txtThorbjørn Lindeijer1-152/+140
Especially to change them to lowercase.
2022-08-19Apply C++11 fixitsThorbjørn Lindeijer51-396/+272
modernize-loop-convert modernize-deprecated-headers
2022-08-19Apply C++11 fixitsThorbjørn Lindeijer107-507/+476
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2022-08-19Updated DALStorage -> Storage in error messagesThorbjørn Lindeijer3-78/+78
Finishing 213af0fbde3f198ad1ab2143d32fc6798b7f8f50.
2022-08-19Avoid some warning, iircThorbjørn Lindeijer1-2/+2
2022-08-19Premature optimization based on clazy hintThorbjørn Lindeijer1-1/+3
2022-08-19Added net_accountListenToGameHost config optionThorbjørn Lindeijer3-3/+6
This is because the network interface on which the account server listens to the game server does not need to match the one on which the account server listens to the client.
2022-08-19Fixed possible leak in AccountHandler::handleUnregisterMessageThorbjørn Lindeijer5-80/+85
Fixed by changing account instances to be managed by std::unique_ptr, so we don't forget to delete them somewhere, like in that function as well as during shutdown in AccountHandler.
2022-06-16Updated PhysFS usageThorbjørn Lindeijer1-6/+7
We now require at least PhysFS 2.1. Also no longer add the "current directory" to the search path and allow the "PKG_DATADIR" used to locate files shipping with the server to be overridden by the "serverPath" configuration variable. Closes #81
2022-06-16Removed usage of deprecated std::unary_functionThorbjørn Lindeijer1-4/+2
Appears to have been entirely unnecessary.
2022-05-25Check return value for enet_peer_sendThorbjørn Lindeijer2-6/+18
If it fails, we will need to destroy the packet ourselves rather than relying on enet to eventually destroy it.
2022-05-25Fixed compile against Lua 5.4Thorbjørn Lindeijer1-4/+9
Now lua_resume takes 4 arguments, and the number of result values is set on the 4th one.
2022-05-25Fixed compiler warnings about dynamic exception specificationsThorbjørn Lindeijer3-15/+6
"warning: dynamic exception specifications are deprecated in C++11" Fortunately, it's effectively the same thing as not mentioning anything at all. The fact that these functions can throw this exception is already in their documentation.
2018-10-03Install sql scriptsErik Schilling1-0/+2
2018-09-13Do not search for old lua explicitlyErik Schilling1-1/+1
We also support the newer versions and systems like Fedora do not ship the older lua versions.
2015-06-07Fixed compile when using Lua 5.3Thorbjørn Lindeijer2-5/+3
It seems like properly upgrading to Lua 5.3 would affect quite a few small function calls, but fortunately compatibility can be achieved with just a define for now.
2015-06-07Fixing some compilation issues when using GCC 5.1Thorbjørn Lindeijer2-4/+4
For whatever reason, GCC 5.1 no longer finds an operator<< overload for streaming a std::ostringstream into a std::ostringstream.
2015-04-25Do not pollute the context with the icu namespaceErik Schilling1-0/+3
2015-04-24Fix crash if the client sends garbage public id valuesErik Schilling1-1/+5
Indexing an array with a negative int as index is no good idea...
2014-03-02IdManager tweaksThorbjørn Lindeijer1-4/+2
2014-02-03Fixed SQL InjectionErik Schilling1-3/+4
2013-12-29Small cleanupErik Schilling6-19/+11
- Deleted empty constructor rather than throwing, resulting in compiletime errors rather than runtime errors. - Removed some remainings of currentMana - Fixed some compiler warnings regarding structs getting forward declared as classes.
2013-12-08Restored copy constructor protection for mapcompositeErik Schilling1-0/+1
2013-12-08deleted copy constructors in Component rather than all the subclassesErik Schilling4-16/+11
2013-12-08Delete some unused copy constructorsThorbjørn Lindeijer5-13/+10
2013-11-28Include the list of characters in the login responseThorbjørn Lindeijer4-14/+17
This makes it easier on the client to decide whether to immediately open the Create Character page or to go to the Choose Character page. Still supports client version 9 as well.
2013-11-02Do not send dir changes back to the player itselfErik Schilling1-1/+1
2013-11-01Fixed typo in docsErik Schilling1-2/+2
2013-10-19Fixed negative attribute valuesErik Schilling1-1/+1
Note @Bertram25: c++11 comes with lowest() min() for float types only returns the next positive value > 0.
2013-10-16Fixed protocol descriptionErik Schilling1-1/+1
2013-10-13Changed argument to const &Thorbjørn Lindeijer1-1/+2
2013-10-13Added GPMSG_NPC_BUYSELL_RESPONSEThorbjørn Lindeijer2-7/+19
Without this message it is not possible to reliably know how many items were traded with an NPC at the client side. It helps with updating the shop's inventory.
2013-10-06Marked getRandomString as staticThorbjørn Lindeijer1-1/+1
2013-10-01Send the character data in a single messageErik Schilling2-36/+30
2013-09-30Removed outdated commentErik Schilling1-4/+0
2013-09-30Actually send and store the equipment slotErik Schilling2-15/+6
I was wrong to assume that we do not need it. The accountserver needs to send the info the the client in order to display the equipment on the character selection page.
2013-09-29Fixed parameters of setting global cooldownErik Schilling1-1/+1
2013-09-26Removed unrequired if checkErik Schilling1-34/+28
wrapped the code parts with {} to prevent trashing the scope too much
2013-09-26Store questlog values in the databaseErik Schilling11-48/+341