From 48021640ce0e76f1dfd7527b88fa33f2b74f4909 Mon Sep 17 00:00:00 2001
From: mekolat <mekolat@users.noreply.github.com>
Date: Sun, 17 May 2015 16:59:59 -0400
Subject: reject very old manaplus versions

---
 src/char/char.cpp | 9 +++++++++
 src/char/char.hpp | 3 +++
 2 files changed, 12 insertions(+)

(limited to 'src')

diff --git a/src/char/char.cpp b/src/char/char.cpp
index 345265f..7ad6dff 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -62,6 +62,7 @@
 #include "../proto2/any-user.hpp"
 #include "../proto2/login-admin.hpp"
 #include "../proto2/login-char.hpp"
+#include "../proto2/login-user.hpp"
 #include "../proto2/char-map.hpp"
 #include "../proto2/char-user.hpp"
 
@@ -2259,6 +2260,14 @@ void parse_char(Session *s)
                     special.magic_packet_length = 4;
                     send_ppacket<0x8000>(s, special);
 
+                    if(sd->packet_client_version < MIN_CLIENT_VERSION)
+                    {
+                        Packet_Fixed<0x006a> fixed_6a;
+                        fixed_6a.error_code = 5;
+                        send_fpacket<0x006a, 23>(s, fixed_6a);
+                        goto x65_out;
+                    }
+
                     // search authentification
                     for (AuthFifoEntry& afi : auth_fifo)
                     {
diff --git a/src/char/char.hpp b/src/char/char.hpp
index 049875b..8adac4d 100644
--- a/src/char/char.hpp
+++ b/src/char/char.hpp
@@ -42,6 +42,9 @@ std::chrono::seconds DEFAULT_AUTOSAVE_INTERVAL = 5_min;
 constexpr
 GmLevel default_gm_level = GmLevel::from(0_u32);
 
+// increase the min version when the protocol is incompatible with old m+ versions
+#define MIN_CLIENT_VERSION 1
+
 struct AuthFifoEntry
 {
     AccountId account_id;
-- 
cgit v1.2.3-70-g09d2