From 3a8c3dd23d4f7c3cebed8f83cbae25a6f3af7d30 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Thu, 7 Jul 2022 00:51:22 +0300
Subject: [PATCH 08/47] Prohibit changing ruleset given from commandline

See osdn #45042

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 server/stdinhand.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/server/stdinhand.c b/server/stdinhand.c
index ead9c7c769..7da2836496 100644
--- a/server/stdinhand.c
+++ b/server/stdinhand.c
@@ -3918,6 +3918,14 @@ bool set_rulesetdir(struct connection *caller, const char *str, bool check,
                 "see what is the current ruleset."));
     return FALSE;
   }
+
+  if (srvarg.ruleset != NULL && is_restricted(caller)) {
+    cmd_reply(CMD_RULESETDIR, caller, C_FAIL,
+              _("Changing ruleset not allowed. It was locked from the commandline."));
+
+    return FALSE;
+  }
+
   if (game_was_started() || !map_is_empty()) {
     cmd_reply(CMD_RULESETDIR, caller, C_FAIL,
               _("This setting can't be modified after the game has started."));
-- 
2.35.1