]> granicus.if.org Git - nethack/commitdiff
Allow admin to disable explore mode
authorPasi Kallinen <paxed@alt.org>
Tue, 31 Mar 2015 15:14:10 +0000 (18:14 +0300)
committerPasi Kallinen <paxed@alt.org>
Tue, 31 Mar 2015 15:14:16 +0000 (18:14 +0300)
Some public servers want to disable explore mode, so
make it configurable in sysconf.

doc/Guidebook.mn
doc/Guidebook.tex
include/sys.h
src/cmd.c
src/files.c
src/sys.c
sys/unix/sysconf
sys/winnt/sysconf

index df7301a81af591398ab6c2b0d508747f4b3a4486..4293fdb3e81d332949ebc42c9826a546e7997f9a 100644 (file)
@@ -2922,6 +2922,10 @@ SHELLERS
 A list of users who are allowed to use the shell escape command (!).  The
 syntax is the same as WIZARDS.
 .lp
+EXPLORERS
+A list of users who are allowed to use the explore mode.  The
+syntax is the same as WIZARDS.
+.lp
 MAXPLAYERS
 Limit the maximum number of games that can be running at the same time.
 .lp
index 7c2464664650a24e68b5ed683bcedf831007bc20..5f1ae5e4b215549ac55283cd61363766b68cf69e 100644 (file)
@@ -3494,6 +3494,10 @@ asterisk (*) allows anyone to start a game in wizard mode.
 A list of users who are allowed to use the shell escape command (!).
 The syntax is the same as WIZARDS.
 %.lp
+\item[\ib{EXPLORERS}]
+A list of users who are allowed to use the explore mode.
+The syntax is the same as WIZARDS.
+%.lp
 \item[\ib{MAXPLAYERS}]
 Limit the maximum number of games taht can be running at the same time.
 %.lp
index b97f7ca807e794995b594b746718ab5caa093f45..84d42b5b62a1803f3da67f3285c93dbce08d2e4c 100644 (file)
@@ -10,6 +10,7 @@ struct sysopt {
        char *support;  /* local support contact */
        char *recover;  /* how to run recover - may be overridden by win port */
        char *wizards;
+       char *explorers;
        char *shellers; /* like wizards, for ! command (-DSHELL) */
        char *debugfiles; /* files to show debugplines in. '*' is all. */
        int env_dbgfl;  /*  1: debugfiles comes from getenv("DEBUGFILES")
index 8b74085337e50518ec66cbff2c39146f28b6834c..b028c57a3d3a888c069ea922672ebfecb2eec10e 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -509,6 +509,14 @@ enter_explore_mode(VOID_ARGS)
     } else if (discover) {
        You("are already in explore mode.");
     } else {
+#ifdef SYSCF
+       if (!sysopt.explorers ||
+           !sysopt.explorers[0] ||
+           !check_user_string(sysopt.explorers)) {
+           You("cannot access explore mode.");
+           return 0;
+       }
+#endif
        pline(
         "Beware!  From explore mode there will be no return to normal game.");
        if (paranoid_query(ParanoidQuit,
index ace417e7dd67f6a0f33f3123e9745ef4cafa78f0..179cd34377ebde655c44f4d286326d8f43eae6d7 100644 (file)
@@ -2184,6 +2184,9 @@ int               src;
        } else if (src == SET_IN_SYS && match_varname(buf, "SHELLERS", 8)) {
            if (sysopt.shellers) free(sysopt.shellers);
            sysopt.shellers = dupstr(bufp);
+       } else if (src == SET_IN_SYS && match_varname(buf, "EXPLORERS", 7)) {
+           if (sysopt.explorers) free(sysopt.explorers);
+           sysopt.explorers = dupstr(bufp);
        } else if (src == SET_IN_SYS && match_varname(buf, "DEBUGFILES", 5)) {
            if (sysopt.debugfiles) free(sysopt.debugfiles);
            /* if showdebug() has already been called (perhaps we've added
index 35e46b7c809f31f6280655871dc55a6b4924e9d0..6ca0017f798603a16cd7a9e5c584f074e66b52af 100644 (file)
--- a/src/sys.c
+++ b/src/sys.c
@@ -33,6 +33,7 @@ sys_early_init()
 #endif
        sysopt.env_dbgfl = 0;   /* haven't checked getenv("DEBUGFILES") yet */
        sysopt.shellers = NULL;
+       sysopt.explorers = NULL;
        sysopt.maxplayers = 0;  /* XXX eventually replace MAX_NR_OF_PLAYERS */
 
                /* record file */
index cff28b04f4b1adeadf6967514fef83f2a744bd5e..50fa74085afc75b58d788a8c184fdd84c5e7c4e8 100644 (file)
@@ -14,6 +14,9 @@ WIZARDS=root games
 # Uses the same syntax as the WIZARDS option above.
 #SHELLERS=
 
+# Users allowed to use #exploremode. Same syntax as WIZARDS above.
+EXPLORERS=*
+
 # Show debugging information originating from these source files.
 # Use '*' for all, or list source files separated by spaces.
 # Only available if game has been compiled with DEBUG.
index 67c0b814d2792afe66eb507c9fc56d6e11dbdd15..808546da8bddaf6990dc9afb3390d2c2b5bdc973 100644 (file)
@@ -14,6 +14,9 @@ WIZARDS=*
 # Uses the same syntax as the WIZARDS option above.
 #SHELLERS=
 
+# Users allowed to use #exploremode. Same syntax as WIZARDS above.
+EXPLORERS=*
+
 # Show debugging information originating from these source files.
 # Use '*' for all, or list source files separated by spaces.
 # Only available if game has been compiled with DEBUG.