[prev in list] [next in list] [prev in thread] [next in thread]
List: openbsd-bugs
Subject: Re: ports/5589: cannot run nethack in wizard mode b/c no uid games
From: Joachim Schipper <j.schipper () math ! uu ! nl>
Date: 2007-09-26 20:48:05
Message-ID: 20070926204804.GC14930 () melpomene ! jschipper ! dynalias ! net
[Download RAW message or body]
On Sun, Sep 23, 2007 at 04:15:01PM -0600, Joachim Schipper wrote:
> On Sun, Sep 23, 2007 at 05:13:32PM -0400, jared r r spiegel . spieg wrote:
> > - nethack port has patches/patch-include_config_h which
> > includes a ``#define WIZARD "games"''.
> > - ${WRKSRC}/sys/unix/unixmain.c (and ${WRKSRC}/sys/vms/vmsmain.c)
> > only set 'wizard = TRUE' after having gone through
> > a few hoops to satisfy itself that it is being run
> > by the same username as WIZARD is defined as.
> > - one cannot run nethack in wizard mode because user games
> > does not exist
> > >How-To-Repeat:
> > - install nethack
> > - run nethack with -D
> > - receive notice that only user games may access wizmode
> > - be fraught with dismay as there is no user "games", only a group, thus
> > no way to run wizmode.
> > >Fix:
> > - assuming there currently is no way, using the pkg, to access
> > real wizmode instead of just discovery mode:
> >
> > - in patches/patch-include_config_h, change "games" to "bin".
> > bin has an entry in /etc/passwd and one can su/sudo to/as that user,
> > and then nethack can be run in wizmode.
>
> Would it not be a better idea to either:
> a) hack nethack to allow any user to enter wizard mode
> b) #define WIZARD _nethack-wizard, and instruct the user to
> create a user _nethack-wizard if wizardmode play is desired?
> c) get nethack to read a configuration file to determine who can
> have full wizard mode?
>
> 'bin' has far too many priviliges.
>
> If nobody has a better idea, I'll try to write a patch implementing c)
> Real Soon Now, which means it'll probably be finished by wednesday or
> thursday, as I am rather busy.
Here is a simple patch, implementing a); implementing c) isn't terribly
difficult, and I'll be happy to prepare a patch if anyone cares, but
after thinking it over a little I fail to see any reason to do it that
way.
If Marc thinks this is a good idea, can he please commit this?
Joachim
diff -Nurd /usr/ports/games/nethack/Makefile ./Makefile
--- /usr/ports/games/nethack/Makefile Sat Oct 14 12:01:09 2006
+++ ./Makefile Wed Sep 26 22:17:21 2007
@@ -4,7 +4,7 @@
COMMENT= "dungeon explorin', hackin', game. Piece of cake"
V=3.4.3
DISTNAME= nethack-$V
-PKGNAME= ${DISTNAME}p1
+PKGNAME= ${DISTNAME}p2
CATEGORIES= games
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=nethack/} \
diff -Nurd /usr/ports/games/nethack/patches/patch-doc_nethack_6 ./patches/patch-doc_nethack_6
--- /usr/ports/games/nethack/patches/patch-doc_nethack_6 Thu Jan 1 01:00:00 1970
+++ ./patches/patch-doc_nethack_6 Wed Sep 26 22:36:54 2007
@@ -0,0 +1,13 @@
+$OpenBSD$
+--- doc/nethack.6.orig Wed Sep 26 22:36:40 2007
++++ doc/nethack.6 Wed Sep 26 22:36:48 2007
+@@ -188,8 +188,7 @@ or
+ .B \-X
+ option will start the game in a special non-scoring discovery mode.
+ .B \-D
+-will, if the player is the game administrator, start in debugging (wizard)
+-mode instead.
++will start in debugging (wizard) mode instead.
+ .PP
+ The
+ .B \-d
diff -Nurd /usr/ports/games/nethack/patches/patch-doc_nethack_txt ./patches/patch-doc_nethack_txt
--- /usr/ports/games/nethack/patches/patch-doc_nethack_txt Thu Jan 1 01:00:00 1970
+++ ./patches/patch-doc_nethack_txt Wed Sep 26 22:36:55 2007
@@ -0,0 +1,15 @@
+$OpenBSD$
+--- doc/nethack.txt.orig Wed Sep 26 22:36:42 2007
++++ doc/nethack.txt Wed Sep 26 22:36:48 2007
+@@ -113,9 +113,8 @@ DESCRIPTION
+ game administrator.
+
+ The -D or -X option will start the game in a special non-
+- scoring discovery mode. -D will, if the player is the
+- game administrator, start in debugging (wizard) mode
+- instead.
++ scoring discovery mode. -D will start in debugging (wiz-
++ ard) mode instead.
+
+ The -d option, which must be the first argument if it
+ appears, supplies a directory which is to serve as the
diff -Nurd /usr/ports/games/nethack/patches/patch-include_config_h ./patches/patch-include_config_h
--- /usr/ports/games/nethack/patches/patch-include_config_h Wed Aug 11 12:15:07 2004
+++ ./patches/patch-include_config_h Wed Sep 26 22:17:02 2007
@@ -1,6 +1,6 @@
$OpenBSD: patch-include_config_h,v 1.5 2004/08/11 10:15:07 espie Exp $
--- include/config.h.orig Mon Dec 8 00:39:13 2003
-+++ include/config.h Tue Aug 10 13:32:55 2004
++++ include/config.h Wed Sep 26 22:12:23 2007
@@ -84,7 +84,7 @@
#ifdef QT_GRAPHICS
@@ -27,8 +27,16 @@
#ifndef WIZARD /* allow for compile-time or Makefile changes */
# ifndef KR1ED
# define WIZARD "wizard" /* the person allowed to use the -D option */
-@@ -169,11 +170,13 @@
+@@ -150,6 +151,7 @@
+ # endif
+ #endif
++#define WIZARD_ALL /* all users can play in wizard mode */
+ #define LOGFILE "logfile" /* larger file for debugging purposes */
+ #define NEWS "news" /* the file containing the latest hack news */
+ #define PANICLOG "paniclog" /* log of panic and impossible events */
+@@ -169,11 +171,13 @@
+
#ifdef UNIX
/* path and file name extension for compression program */
-#define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */
@@ -43,7 +51,7 @@
#endif
#ifndef COMPRESS
-@@ -300,7 +303,7 @@ typedef unsigned char uchar;
+@@ -300,7 +304,7 @@ typedef unsigned char uchar;
* functions that have been macroized.
*/
diff -Nurd /usr/ports/games/nethack/patches/patch-sys_unix_unixmain_c ./patches/patch-sys_unix_unixmain_c
--- /usr/ports/games/nethack/patches/patch-sys_unix_unixmain_c Thu Jan 1 01:00:00 1970
+++ ./patches/patch-sys_unix_unixmain_c Wed Sep 26 22:17:02 2007
@@ -0,0 +1,23 @@
+$OpenBSD$
+--- sys/unix/unixmain.c.orig Wed Sep 26 22:10:51 2007
++++ sys/unix/unixmain.c Wed Sep 26 22:11:47 2007
+@@ -306,6 +306,11 @@ char *argv[];
+ switch(argv[0][1]){
+ case 'D':
+ #ifdef WIZARD
++#ifdef WIZARD_ALL
++ /* All users can run as wizard */
++ wizard = TRUE;
++ break;
++#else
+ {
+ char *user;
+ int uid;
+@@ -334,6 +339,7 @@ char *argv[];
+ }
+ /* otherwise fall thru to discover */
+ wiz_error_flag = TRUE;
++#endif
+ #endif
+ case 'X':
+ discover = TRUE;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic