aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-09-19 23:46:26 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-09-19 23:46:26 -0300
commita8a6a140186f97bb01e2f5e9e5cd746850d36684 (patch)
treef8cce5ebd2370037c25676af12be7a597ec07fbd
parent73dcabd0aad275e03a20b512e554dcd4c4a5b814 (diff)
downloadlogin-a8a6a140186f97bb01e2f5e9e5cd746850d36684.tar.gz
login-a8a6a140186f97bb01e2f5e9e5cd746850d36684.zip
support 7.72 with non-default `-DTIBIA772=1` switch
-rw-r--r--src/connections.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/connections.cc b/src/connections.cc
index ac5d4ca..e640cb6 100644
--- a/src/connections.cc
+++ b/src/connections.cc
@@ -13,7 +13,12 @@
# error "Operating system not currently supported."
#endif
+#if TIBIA772
+static const int TERMINALVERSION[] = {772, 772, 772};
+#else
static const int TERMINALVERSION[] = {770, 770, 770};
+#endif
+
static RSAKey *g_PrivateKey = NULL;
static int g_Listener = -1;
static TConnection *g_Connections = NULL;
@@ -474,7 +479,10 @@ void ProcessLoginRequest(TConnection *Connection){
return;
}
- if(!RSADecrypt(g_PrivateKey, AsymmetricData, sizeof(AsymmetricData))){
+ // IMPORTANT(fusion): Without a checksum, there is no way of validating
+ // the asymmetric data. The best we can do is to verify that the first
+ // plaintext byte is ZERO, but that alone isn't enough.
+ if(!RSADecrypt(g_PrivateKey, AsymmetricData, sizeof(AsymmetricData)) || AsymmetricData[0] != 0){
LOG_ERR("Failed to decrypt asymmetric data from %s",
Connection->RemoteAddress);
CloseConnection(Connection);