Readded special client permissions

Also added a command that requires a password to gain the permissions.
I think they were never vulnerable in the first place, gamerfood was just trying to intimidate us.
This commit is contained in:
juanjp600
2016-11-20 22:01:37 -03:00
parent 7a3bce3973
commit ba7fcad8f2
7 changed files with 81 additions and 9 deletions

View File

@@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Barotrauma.Networking;
using Barotrauma.Items.Components;
using System.Text;
namespace Barotrauma
{
@@ -123,7 +124,6 @@ namespace Barotrauma
if (PlayerInput.KeyDown(Keys.Enter) && textBox.Text != "")
{
NewMessage(textBox.Text, Color.White);
ExecuteCommand(textBox.Text, game);
textBox.Text = "";
@@ -165,6 +165,7 @@ namespace Barotrauma
case "netstats":
case "help":
case "dumpids":
case "admin":
return true;
default:
return false;
@@ -175,7 +176,11 @@ namespace Barotrauma
{
if (string.IsNullOrWhiteSpace(command)) return;
string[] commands = command.Split(' ');
if (!commands[0].ToLowerInvariant().Equals("admin"))
{
NewMessage(textBox.Text, Color.White);
}
#if !DEBUG
if (GameMain.Client != null && !IsCommandPermitted(commands[0].ToLowerInvariant(), GameMain.Client))
@@ -370,6 +375,17 @@ namespace Barotrauma
case "enablecrewai":
HumanAIController.DisableCrewAI = false;
break;
case "admin":
if (GameMain.Server != null)
{
GameMain.Server.AdminAuthPass = commands[1];
}
else if (GameMain.Client != null)
{
GameMain.Client.RequestAdminAuth(commands[1]);
}
break;
case "kick":
if (GameMain.NetworkMember == null || commands.Length < 2) break;
GameMain.NetworkMember.KickPlayer(string.Join(" ", commands.Skip(1)), false);