From b506a7407661c0527255466cf8b315824b0003c0 Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Sun, 13 Apr 2014 13:04:56 +0200 Subject: Added Yggdrasil Authentication System Code by Howaner. Fixes/Changes by me. --- src/ClientHandle.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 0c367ec7d..0f07c980b 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -62,8 +62,11 @@ public: cPlayer* GetPlayer() { return m_Player; } // tolua_export + const AString & GetUUID(void) const { return m_UUID; } // tolua_export + void setUUID(const AString & a_UUID) { m_UUID = a_UUID; } + void Kick(const AString & a_Reason); // tolua_export - void Authenticate(void); // Called by cAuthenticator when the user passes authentication + void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication void StreamChunks(void); @@ -326,6 +329,7 @@ private: static int s_ClientCount; int m_UniqueID; + AString m_UUID; /** Set to true when the chunk where the player is is sent to the client. Used for spawning the player */ bool m_HasSentPlayerChunk; -- cgit v1.2.3 From d505ffc704d85cc1b31ae87647ba979fda84f46f Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 14 Apr 2014 20:21:00 +0200 Subject: A client UUID is generated when the server is in offline mode. 1.7.9 client works with these changes in offline mode. --- src/ClientHandle.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 0f07c980b..90b971e16 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -63,7 +63,12 @@ public: cPlayer* GetPlayer() { return m_Player; } // tolua_export const AString & GetUUID(void) const { return m_UUID; } // tolua_export - void setUUID(const AString & a_UUID) { m_UUID = a_UUID; } + void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; } + + /** Generates an UUID based on the player name provided. + This is used for the offline (non-auth) mode, when there's no UUID source. + Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. */ + void GenerateOfflineUUID(void); void Kick(const AString & a_Reason); // tolua_export void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication -- cgit v1.2.3 From d12d7b671523f79f760403f3f4c0ef4efb497c79 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Mon, 14 Apr 2014 22:52:59 +0200 Subject: Implemented the 1.7.6 protocol and authenticator. Server works both in online and offline modes with 1.7.9. --- src/ClientHandle.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 90b971e16..12e0256de 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -65,10 +65,16 @@ public: const AString & GetUUID(void) const { return m_UUID; } // tolua_export void SetUUID(const AString & a_UUID) { m_UUID = a_UUID; } + /** Generates an UUID based on the username stored for this client, and stores it in the m_UUID member. + This is used for the offline (non-auth) mode, when there's no UUID source. + Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. + Internally calls the GenerateOfflineUUID static function. */ + void GenerateOfflineUUID(void); + /** Generates an UUID based on the player name provided. This is used for the offline (non-auth) mode, when there's no UUID source. Each username generates a unique and constant UUID, so that when the player reconnects with the same name, their UUID is the same. */ - void GenerateOfflineUUID(void); + static AString GenerateOfflineUUID(const AString & a_Username); // tolua_export void Kick(const AString & a_Reason); // tolua_export void Authenticate(const AString & a_Name, const AString & a_UUID); // Called by cAuthenticator when the user passes authentication -- cgit v1.2.3