]> granicus.if.org Git - nethack/commitdiff
Allow disabling savefile UID checking in sysconf
authorPasi Kallinen <paxed@alt.org>
Sat, 11 Apr 2015 18:07:57 +0000 (21:07 +0300)
committerPasi Kallinen <paxed@alt.org>
Sat, 11 Apr 2015 18:07:57 +0000 (21:07 +0300)
doc/Guidebook.mn
doc/Guidebook.tex
include/sys.h
src/files.c
src/restore.c
src/sys.c
sys/unix/sysconf

index 66b27f5bf3789d51d3765536622c352ab234503e..910372edde029f57c7708541a020de1b7259ab23 100644 (file)
@@ -3007,6 +3007,9 @@ A string explaining how to recover a game on this system (no default value).
 SEDUCE
 0 or 1 to disable or enable, respectively, the SEDUCE option (see the source
 for details on this function).
+.lp
+CHECK_SAVE_UID
+0 or 1 to disable or enable, respectively, the UID checking for savefiles.
 .pg
 The following options affect the score file:
 .pg
index ae3cfa8a7b906d08c06d951ece35d733bf5b0448..1f2bb198b2a44b3a078cce9ca7193e125279746a 100644 (file)
@@ -3597,6 +3597,9 @@ A string explaining how to recover a game on this system (no default value).
 \item[\ib{SEDUCE}]
 0 or 1 to disable or enable, respectively, the SEDUCE option (see the source)
 for details on this function.
+%.lp
+\item[\ib{CHECK\_SAVE\_UID}]
+0 or 1 to disable or enable, respectively, the UID checking for savefiles.
 \elist
 
 %.pg
index 84d42b5b62a1803f3da67f3285c93dbce08d2e4c..8b6c4b502722326c161beb85df0d9ad245db01af 100644 (file)
@@ -35,6 +35,7 @@ struct sysopt {
 # endif
 #endif
        int seduce;
+       int check_save_uid; /* restoring savefile checks UID? */
 };
 
 extern  struct sysopt sysopt;
index 2388e032d1bdfe30707389f9208e8d360311899c..1ed9a3c052e5e98214d279bd645d1b7ec6bbba0f 100644 (file)
@@ -2206,6 +2206,9 @@ int               src;
     } else if (src == SET_IN_SYS && match_varname(buf, "RECOVER", 7)) {
         if (sysopt.recover) free(sysopt.recover);
         sysopt.recover = dupstr(bufp);
+    } else if (src == SET_IN_SYS && match_varname(buf, "CHECK_SAVE_UID", 14)) {
+       n = atoi(bufp);
+       sysopt.check_save_uid = n;
     } else if (match_varname(buf, "SEDUCE", 6)) {
         n = !!atoi(bufp);      /* XXX this could be tighter */
         /* allow anyone to turn it off, but only sysconf to turn it on*/
index d46adbb31d06f7f720d42f0eb750601d1a92e640..1caab6108f8ed2fea171a7a372599bfdb6c27dc3 100644 (file)
@@ -502,6 +502,13 @@ register struct obj *otmp;
        else otmp->spe = fruitadd(oldf->fname, (struct fruit *)0);
 }
 
+
+#ifdef SYSCF
+#define SYSOPT_CHECK_SAVE_UID sysopt.check_save_uid
+#else
+#define SYSOPT_CHECK_SAVE_UID TRUE
+#endif
+
 STATIC_OVL
 boolean
 restgamestate(fd, stuckid, steedid)
@@ -517,7 +524,7 @@ unsigned int *stuckid, *steedid;
        unsigned long uid;
 
        mread(fd, (genericptr_t) &uid, sizeof uid);
-       if (uid != (unsigned long)getuid()) {           /* strange ... */
+       if (SYSOPT_CHECK_SAVE_UID && uid != (unsigned long)getuid()) {          /* strange ... */
            /* for wizard mode, issue a reminder; for others, treat it
               as an attempt to cheat and refuse to restore this file */
            pline("Saved game was not yours.");
index 6ca0017f798603a16cd7a9e5c584f074e66b52af..e698627be1d0e9a18c286f786e5ac5437d111431 100644 (file)
--- a/src/sys.c
+++ b/src/sys.c
@@ -67,6 +67,7 @@ sys_early_init()
 # endif
 #endif
 
+       sysopt.check_save_uid = 1;
        sysopt.seduce = 1;      /* if it's compiled in, default to on */
        sysopt_seduce_set(sysopt.seduce);
 }
index 50fa74085afc75b58d788a8c184fdd84c5e7c4e8..aff14b8c7f7f808164af3f687f4a9914071f8c84 100644 (file)
@@ -35,6 +35,9 @@ MAXPLAYERS=10
 # Uncomment the next line to disable the SEDUCE option.
 #SEDUCE=0
 
+# Uncomment to disable savefile UID checking.
+#CHECK_SAVE_UID=0
+
 # Record (high score) file options.
 # CAUTION: changing these after people have started playing games can
 #  lead to lost high scores!