From 740ad4d6c3226e69122f901a9736d23e821de267 Mon Sep 17 00:00:00 2001 From: Patrikk Date: Sun, 10 Dec 2017 20:14:54 +0100 Subject: [PATCH 01/17] Add missing "if handled - return" code. --- TShockAPI/TShock.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index ee403eab..5d59dc8a 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -522,6 +522,11 @@ namespace TShockAPI /// args - The NameCollisionEventArgs object. private void NetHooks_NameCollision(NameCollisionEventArgs args) { + if (args.Handled) + { + return; + } + string ip = Utils.GetRealIP(Netplay.Clients[args.Who].Socket.GetRemoteAddress().ToString()); var player = Players.First(p => p != null && p.Name == args.Name && p.Index != args.Who); From 6f044b2123c744e5673d63e883958be15770c91d Mon Sep 17 00:00:00 2001 From: Patrikk Date: Sun, 10 Dec 2017 20:37:59 +0100 Subject: [PATCH 02/17] Adding missing Changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1a85365..e50ee4a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large. ## Upcoming Changes +* API: Added return in OnNameCollision if hook has been handled. (@Patrikkk) * API: Added hooks for item, projectile and tile bans (@deadsurgeon42) * API: Changed `PlayerHooks` permission hook mechanisms to allow negation from hooks (@deadsurgeon42) * API: New WorldGrassSpread hook which shold allow corruption/crimson/hallow creep config options to work (@DeathCradle) From 1f79e14bd7d4296c859b74514f7cd64c445aaaeb Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Mon, 11 Dec 2017 01:12:27 +0100 Subject: [PATCH 03/17] Make TShock pull OTAPI from the correct folder on build --- TShockAPI/TShockAPI.csproj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 957f805b..a612f444 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -71,11 +71,9 @@ ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - + False - ..\TerrariaServerAPI\TerrariaServerAPI\bin\Debug\OTAPI.dll - ..\TerrariaServerAPI\TerrariaServerAPI\bin\Release\OTAPI.dll - ..\TerrariaServerAPI\TerrariaServerAPI\bin\$(Configuration)\OTAPI.dll + ..\TerrariaServerAPI\TerrariaServerAPI\bin\$(ConfigurationName)\OTAPI.dll From a5e196178e31d9a444ed9b7f2fc542c84f7e7989 Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Mon, 11 Dec 2017 01:16:10 +0100 Subject: [PATCH 04/17] Add credit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e50ee4a5..d4eafb1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Update OTAPI to 2.0.0.31, which also updates Newtonsoft.Json to 10.0.3 (@Ryozuki) * Fixed DumpItems() from trying to dump older versions of certain items (negative item IDs). (@Zaicon) * Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro) +* Fixed builds to not require a specific version of OTAPI and to not fail when in Release mode (@bartico6) ## TShock 4.3.24 * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) From 1e233d15e72c1441029a59574e8da7dc708dae0d Mon Sep 17 00:00:00 2001 From: quake1337 <3310937+bartico6@users.noreply.github.com> Date: Mon, 11 Dec 2017 15:33:53 +0100 Subject: [PATCH 05/17] Update submodule --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index e76b7d18..faa3b956 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit e76b7d18175163cc9375361494ca6283113c4389 +Subproject commit faa3b95697bbf675503b2823c5f59593cf825bb3 From c1c57160068b5569aac9dc7fa801b41134198383 Mon Sep 17 00:00:00 2001 From: Ryozuki Date: Mon, 11 Dec 2017 16:26:19 +0100 Subject: [PATCH 06/17] update assembly company to Pryaxis --- TShockAPI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index c5fc1426..9ebbdb5f 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -26,7 +26,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("TShock for Terraria")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Nyx Studios & TShock Contributors")] +[assembly: AssemblyCompany("Pryaxis & TShock Contributors")] [assembly: AssemblyProduct("TShockAPI")] [assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2017")] [assembly: AssemblyTrademark("")] From bbabec6003bb17d5c140c470c20db9d2f8f7edc1 Mon Sep 17 00:00:00 2001 From: Ryozuki Date: Mon, 11 Dec 2017 16:29:37 +0100 Subject: [PATCH 07/17] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4eafb1d..d3ce77d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Fixed DumpItems() from trying to dump older versions of certain items (negative item IDs). (@Zaicon) * Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro) * Fixed builds to not require a specific version of OTAPI and to not fail when in Release mode (@bartico6) +* Update Assembly Company to Pryaxis (@Ryozuki) ## TShock 4.3.24 * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) From b3928905519abaccfdbe9cd735ee13ed2fe0ba30 Mon Sep 17 00:00:00 2001 From: Ryozuki Date: Mon, 11 Dec 2017 23:09:07 +0100 Subject: [PATCH 08/17] update copyright notice --- TShockAPI/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 9ebbdb5f..f4030480 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -28,7 +28,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Pryaxis & TShock Contributors")] [assembly: AssemblyProduct("TShockAPI")] -[assembly: AssemblyCopyright("Copyright © Nyx Studios 2011-2017")] +[assembly: AssemblyCopyright("Copyright © Pryaxis & TShock Contributors 2011-2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] From 4ea7d10482ee68a150339ae4f7c1f40c7a9cf52d Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 11 Dec 2017 15:45:23 -0700 Subject: [PATCH 09/17] Remove stupid updates permission. Fixes #1540. --- TShockAPI/Permissions.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs index bad4148f..d4fb9229 100644 --- a/TShockAPI/Permissions.cs +++ b/TShockAPI/Permissions.cs @@ -125,9 +125,6 @@ namespace TShockAPI [Description("User can reload the configurations file.")] public static readonly string cfgreload = "tshock.cfg.reload"; - [Description("User can download updates to plugins that are currently running.")] - public static readonly string updateplugins = "tshock.cfg.updateplugins"; - [Description("User can create reference files of Terraria IDs and the permission matrix in the server folder.")] public static readonly string createdumps = "tshock.cfg.createdumps"; From 611fb6b418d807e8539d19ac7068e7d24d93f11c Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 11 Dec 2017 15:45:42 -0700 Subject: [PATCH 10/17] Remove /restart command. Fixes #1454. --- TShockAPI/Commands.cs | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index b2f08d5f..4f2cba4c 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -366,10 +366,6 @@ namespace TShockAPI { HelpText = "Reloads the server configuration file." }); - add(new Command(Permissions.maintenance, Restart, "restart") - { - HelpText = "Restarts the server." - }); add(new Command(Permissions.cfgpassword, ServerPassword, "serverpassword") { HelpText = "Changes the server password." @@ -1902,25 +1898,6 @@ namespace TShockAPI TShock.Utils.StopServer(true, reason); } - private static void Restart(CommandArgs args) - { - if (TShock.NoRestart) - { - args.Player.SendErrorMessage("This command has been disabled."); - return; - } - - if (ServerApi.RunningMono) - { - TShock.Log.ConsoleInfo("Sorry, this command has not yet been implemented in Mono."); - } - else - { - string reason = ((args.Parameters.Count > 0) ? "Server shutting down: " + String.Join(" ", args.Parameters) : "Server shutting down!"); - TShock.Utils.RestartServer(true, reason); - } - } - private static void OffNoSave(CommandArgs args) { string reason = ((args.Parameters.Count > 0) ? "Server shutting down: " + String.Join(" ", args.Parameters) : "Server shutting down!"); From 9cf949cc600841b1f129d00d047598654334b1f2 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 11 Dec 2017 15:47:05 -0700 Subject: [PATCH 11/17] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3ce77d8..5b1e69d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro) * Fixed builds to not require a specific version of OTAPI and to not fail when in Release mode (@bartico6) * Update Assembly Company to Pryaxis (@Ryozuki) +* Removed `/restart` command. (@hakusaro) +* Removed `Permissions.updateplugins` permission. (@hakusaro) ## TShock 4.3.24 * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) From 3bed40ec65cc1066ca37ba52cb295bea70631d16 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 11 Dec 2017 16:01:09 -0700 Subject: [PATCH 12/17] Remove Utils.RestartServer (thanks @QuiCM!) --- TShockAPI/Utils.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/TShockAPI/Utils.cs b/TShockAPI/Utils.cs index e99aadd6..8314de92 100644 --- a/TShockAPI/Utils.cs +++ b/TShockAPI/Utils.cs @@ -580,24 +580,6 @@ namespace TShockAPI Netplay.disconnect = true; } - /// - /// Stops the server after kicking all players with a reason message, and optionally saving the world then attempts to - /// restart it. - /// - /// bool perform a world save before stop (default: true) - /// string reason (default: "Server shutting down!") - public void RestartServer(bool save = true, string reason = "Server shutting down!") - { - if (Main.ServerSideCharacter) - foreach (TSPlayer player in TShock.Players) - if (player != null && player.IsLoggedIn && !player.IgnoreActionsForClearingTrashCan) - TShock.CharacterDB.InsertPlayerData(player); - - StopServer(true, reason); - System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); - Environment.Exit(0); - } - /// /// Reloads all configuration settings, groups, regions and raises the reload event. /// From 69eda3d38e4106bce65a320e7b136beb8706e670 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Mon, 11 Dec 2017 16:09:03 -0700 Subject: [PATCH 13/17] Remove server restart rest routes --- CHANGELOG.md | 1 + TShockAPI/Rest/RestManager.cs | 21 --------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b1e69d1..fe9a120f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Update Assembly Company to Pryaxis (@Ryozuki) * Removed `/restart` command. (@hakusaro) * Removed `Permissions.updateplugins` permission. (@hakusaro) +* Removed REST `/v3/server/restart/` route and `/server/restart/` route. (@hakusaro) ## TShock 4.3.24 * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs index 01341d46..636e0407 100644 --- a/TShockAPI/Rest/RestManager.cs +++ b/TShockAPI/Rest/RestManager.cs @@ -205,7 +205,6 @@ namespace TShockAPI Rest.RegisterRedirect("/server/broadcast", "/v2/server/broadcast"); Rest.RegisterRedirect("/server/reload", "/v2/server/reload"); Rest.RegisterRedirect("/server/off", "/v2/server/off"); - Rest.RegisterRedirect("/server/restart", "/v3/server/restart"); Rest.RegisterRedirect("/server/rawcmd", "/v3/server/rawcmd"); //user commands @@ -247,7 +246,6 @@ namespace TShockAPI Rest.Register(new SecureRestCommand("/v2/server/broadcast", ServerBroadcast)); Rest.Register(new SecureRestCommand("/v3/server/reload", ServerReload, RestPermissions.restcfg)); Rest.Register(new SecureRestCommand("/v2/server/off", ServerOff, RestPermissions.restmaintenance)); - Rest.Register(new SecureRestCommand("/v3/server/restart", ServerRestart, RestPermissions.restmaintenance)); Rest.Register(new SecureRestCommand("/v3/server/rawcmd", ServerCommandV3, RestPermissions.restrawcommand)); Rest.Register(new SecureRestCommand("/tokentest", ServerTokenTest)); @@ -335,25 +333,6 @@ namespace TShockAPI return RestResponse("The server is shutting down"); } - [Description("Attempt to restart the server.")] - [Route("/v3/server/restart")] - [Permission(RestPermissions.restmaintenance)] - [Noun("confirm", true, "Confirm that you actually want to restart the server", typeof(bool))] - [Noun("message", false, "The shutdown message.", typeof(String))] - [Noun("nosave", false, "Shutdown without saving.", typeof(bool))] - [Token] - private object ServerRestart(RestRequestArgs args) - { - if (!GetBool(args.Parameters["confirm"], false)) - return RestInvalidParam("confirm"); - - // Inform players the server is shutting down - var reason = string.IsNullOrWhiteSpace(args.Parameters["message"]) ? "Server is restarting" : args.Parameters["message"]; - TShock.Utils.RestartServer(!GetBool(args.Parameters["nosave"], false), reason); - - return RestResponse("The server is shutting down and will attempt to restart"); - } - [Description("Reload config files for the server.")] [Route("/v3/server/reload")] [Permission(RestPermissions.restcfg)] From 84a0f1f29e129d8eb573a32ac5eca7c6d598e0c2 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 12 Dec 2017 02:56:10 -0700 Subject: [PATCH 14/17] Update submodule for critical exploit fix in TSAPI --- TerrariaServerAPI | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TerrariaServerAPI b/TerrariaServerAPI index a9d1b0e4..c31b0c3c 160000 --- a/TerrariaServerAPI +++ b/TerrariaServerAPI @@ -1 +1 @@ -Subproject commit a9d1b0e4e096ecbd0b2033ce4ff636759c9448c3 +Subproject commit c31b0c3ca12eb638601f140f66c38a956adc1c92 From 9441f1882b98589fa976b747218ed57dc1aacda5 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 12 Dec 2017 02:57:41 -0700 Subject: [PATCH 15/17] Verison Tick: 4.3.25 --- TShockAPI/Properties/AssemblyInfo.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index c5fc1426..c3aa42eb 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -53,5 +53,5 @@ using System.Runtime.InteropServices; // Also, be sure to release on github with the exact assembly version tag as below // so that the update manager works correctly (via the Github releases api and mimic) -[assembly: AssemblyVersion("4.3.24")] -[assembly: AssemblyFileVersion("4.3.24")] +[assembly: AssemblyVersion("4.3.25")] +[assembly: AssemblyFileVersion("4.3.25")] From 270cc4c481577abbed4b539ddb9a0733d823f3ae Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 12 Dec 2017 03:18:44 -0700 Subject: [PATCH 16/17] Update changelog for critical crash fix --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe9a120f..4f47ae8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Removed `/restart` command. (@hakusaro) * Removed `Permissions.updateplugins` permission. (@hakusaro) * Removed REST `/v3/server/restart/` route and `/server/restart/` route. (@hakusaro) +* Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. ## TShock 4.3.24 * Updated OpenTerraria API to 1.3.5.3 (@DeathCradle) From 74eb680bffa737434ba622a64cac3e14c6feb316 Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Tue, 12 Dec 2017 03:31:05 -0700 Subject: [PATCH 17/17] Really update the changelog properly this time --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f47ae8a..b3c1b788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * Removed `/restart` command. (@hakusaro) * Removed `Permissions.updateplugins` permission. (@hakusaro) * Removed REST `/v3/server/restart/` route and `/server/restart/` route. (@hakusaro) + +## TShock 4.3.25 * Fixed a critical exploit in the Terraria protocol that could cause massive unpreventable world corruption as well as a number of other problems. Thanks to @bartico6 for reporting. Fixed by the efforts of @QuiCM, @hakusaro, and tips in the right directioon from @bartico6. ## TShock 4.3.24