diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-07-03 10:10:27 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-07-03 10:46:43 -0300 |
| commit | e65dc561acab7a9e49f59777f16cb040c574c64d (patch) | |
| tree | 2206c066b97b1948a4b98647c91a369d3b9863c8 /src/config.cc | |
| parent | e782274ade8d7307e157a997d6ac3bcaa4130024 (diff) | |
| download | game-e65dc561acab7a9e49f59777f16cb040c574c64d.tar.gz game-e65dc561acab7a9e49f59777f16cb040c574c64d.zip | |
implement `crypto.cc` with OpenSSL + fix config loading
I considered reversing the original `vlong` implementation but
OpenSSL is just simpler, more secure, and most importantly, is
already there. I also made it so the key is now stored in a PEM
file (`tibia.pem`) so it can be easily swapped without re-compiling.
This was the last piece to build and run a working executable,
except that we now need to implement a query manager for the server
to communicate with. I was able to fix a small problem with loading
the config before hitting the problem with the query manager, which
was expected.
The next task should be getting a query manager up and running
before starting phase two of upgrading and fixing the server itself.
Diffstat (limited to 'src/config.cc')
| -rw-r--r-- | src/config.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/config.cc b/src/config.cc index 257985b..b9c33bc 100644 --- a/src/config.cc +++ b/src/config.cc @@ -106,6 +106,7 @@ void ReadConfig(void){ MANAGER_DATABASE.Database[0] = 0; char FileName[4096]; +#if 0 if(const char *Home = getenv("home")){ snprintf(FileName, sizeof(FileName), "%s/.tibia", Home); }else if(const char *Home = getenv("HOME")){ @@ -113,6 +114,9 @@ void ReadConfig(void){ }else{ snprintf(FileName, sizeof(FileName), ".tibia"); } +#else + snprintf(FileName, sizeof(FileName), ".tibia"); +#endif if(!FileExists(FileName)){ throw "cannot find config-file"; @@ -130,7 +134,7 @@ void ReadConfig(void){ } char Identifier[MAX_IDENT_LENGTH]; - strcpy(Identifier, Script.readIdentifier()); + strcpy(Identifier, Script.getIdentifier()); Script.readSymbol('='); // TODO(fusion): Ughh... Get rid of all `strcpy`s. A malicious configuration |
