system-wide configuration file
Add options SYSCF (to add a system-wide configuration file) and SYSCF_FILE (for a file-based implementation of SYSCF) - this allows a binary distribution to be configured at install time. The only option supported at this time is WIZARDS - a list of usernames which can use -D; currently only for unix-likes but should be extendable to anything that has a concept of multiple users. Add mac tty multiuser config using sgid.
This commit is contained in:
@@ -82,6 +82,16 @@
|
||||
a game that was in progress. The recover command is installed in the
|
||||
HACKDIR by default.
|
||||
|
||||
9. If you specified SYSCF (and SYSCF_FILE) in config.h, create the file
|
||||
defined as SYSCF_FILE and fill in any of the following values if you
|
||||
wish to override the compiled-in defaults:
|
||||
WIZARDS= a space-separated list of usernames who can use -D
|
||||
If the first character is '*' then any user can use -D.
|
||||
This is a standards config file, so blank lines and lines starting with
|
||||
pound signs are ignored; while other, standard options (such as catname)
|
||||
can be specified in this file, this is considered a bug and may be changed
|
||||
in the future.
|
||||
|
||||
Notes:
|
||||
|
||||
1. Save files and bones files from previous versions will not work with
|
||||
|
||||
@@ -17,15 +17,17 @@
|
||||
#PREFIX = /usr
|
||||
GAME = nethack
|
||||
# GAME = nethack.prg
|
||||
GAMEUID = games
|
||||
GAMEGRP = bin
|
||||
#GAMEUID = games
|
||||
#GAMEGRP = bin
|
||||
|
||||
# Permissions - some places use setgid instead of setuid, for instance
|
||||
# See also the option "SECURE" in include/config.h
|
||||
GAMEPERM = 04755
|
||||
#GAMEPERM = 04755
|
||||
FILEPERM = 0644
|
||||
# VARFILEPERM = 0644
|
||||
EXEPERM = 0755
|
||||
DIRPERM = 0755
|
||||
# VARDIRPERM = 0755
|
||||
|
||||
# VARDIR may also appear in unixconf.h as "VAR_PLAYGROUND" else HACKDIR
|
||||
#
|
||||
@@ -234,6 +236,7 @@ update: $(GAME) recover $(VARDAT) dungeon spec_levs
|
||||
@echo You may also want to install the man pages via the doc Makefile.
|
||||
|
||||
install: $(GAME) recover $(VARDAT) dungeon spec_levs
|
||||
true; $(PREINSTALL)
|
||||
# set up the directories
|
||||
# not all mkdirs have -p; those that don't will create a -p directory
|
||||
-mkdir -p $(SHELLDIR)
|
||||
@@ -242,14 +245,16 @@ install: $(GAME) recover $(VARDAT) dungeon spec_levs
|
||||
-rmdir ./-p
|
||||
-$(CHOWN) $(GAMEUID) $(HACKDIR) $(VARDIR) $(VARDIR)/save
|
||||
$(CHGRP) $(GAMEGRP) $(HACKDIR) $(VARDIR) $(VARDIR)/save
|
||||
chmod $(DIRPERM) $(HACKDIR) $(VARDIR) $(VARDIR)/save
|
||||
# order counts here:
|
||||
chmod $(DIRPERM) $(HACKDIR)
|
||||
chmod $(VARDIRPERM) $(VARDIR) $(VARDIR)/save
|
||||
# set up the game files
|
||||
( $(MAKE) dofiles )
|
||||
# set up some additional files
|
||||
touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile
|
||||
-( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile ; \
|
||||
$(CHGRP) $(GAMEGRP) perm record logfile ; \
|
||||
chmod $(FILEPERM) perm record logfile )
|
||||
chmod $(VARFILEPERM) perm record logfile )
|
||||
true; $(POSTINSTALL)
|
||||
# and a reminder
|
||||
@echo You may also want to reinstall the man pages via the doc Makefile.
|
||||
|
||||
@@ -24,3 +24,5 @@ WINTTYLIB=-lcurses
|
||||
|
||||
CHOWN=true
|
||||
CHGRP=true
|
||||
|
||||
VARDIRPERM = 0755
|
||||
|
||||
@@ -26,6 +26,7 @@ VARDATND = x11tiles NetHack.ad pet_mark.xbm
|
||||
|
||||
CHOWN=true
|
||||
CHGRP=true
|
||||
VARDIRPERM = 0755
|
||||
|
||||
POSTINSTALL= bdftopcf win/X11/nh10.bdf > $(HACKDIR)/nh10.pcf; (cd $(HACKDIR); mkfontdir)
|
||||
|
||||
|
||||
@@ -29,3 +29,4 @@ WINTTYLIB=-lncurses
|
||||
|
||||
CHOWN=true
|
||||
CHGRP=true
|
||||
VARDIRPERM = 0755
|
||||
|
||||
55
sys/unix/hints/macosx-mu
Normal file
55
sys/unix/hints/macosx-mu
Normal file
@@ -0,0 +1,55 @@
|
||||
#
|
||||
# SCCS Id: @(#)macosx-mu 3.5 2007/12/12
|
||||
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
|
||||
# NetHack may be freely redistributed. See license for details.
|
||||
#
|
||||
# Mac OS X (Darwin) hints file
|
||||
# This is for Mac OS X 10.4.10 (Darwin 8.10). If this doesn't work for some
|
||||
# other version of either Darwin or Mac OS X, make a new file for that OS,
|
||||
# don't change this one.
|
||||
# Useful info: http://www.opensource.apple.com/darwinsource/index.html
|
||||
|
||||
# This is a tty build for a system with multiple users (since it is a tty
|
||||
# build it does not try to look like a .app application).
|
||||
# NetHack will be owned by user "games" and group "bin" - change the next 2
|
||||
# lines if this is a problem:
|
||||
GAMEUID = games
|
||||
GAMEGRP = bin
|
||||
# NB: "make install" should be run as an admin user:
|
||||
# sudo make install
|
||||
|
||||
# NB: do NOT use $(wildcard ~$(GAMEUID)) since the user may not exist yet.
|
||||
PREFIX:=/Users/$(GAMEUID)
|
||||
SHELLDIR=$(PREFIX)/bin
|
||||
HACKDIR=$(PREFIX)/nethackdir
|
||||
|
||||
CC=gcc -W -Wimplicit -Wreturn-type -Wunused -Wformat -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -DGCC_WARN
|
||||
|
||||
# XXX -g vs -O should go here, -I../include goes in the makefile
|
||||
CFLAGS=-g -I../include $(CFLAGS2) $(CFLAGS3)
|
||||
CFLAGS2=-DNOCLIPPING -DNOMAIL -DNOTPARMDECL -DHACKDIR=\"$(HACKDIR)\"
|
||||
CFLAGS3=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
|
||||
|
||||
WINSRC = $(WINTTYSRC)
|
||||
WINOBJ = $(WINTTYOBJ)
|
||||
WINLIB = $(WINTTYLIB)
|
||||
|
||||
WINTTYLIB=-lncurses
|
||||
|
||||
CHOWN=chown
|
||||
CHGRP=chgrp
|
||||
|
||||
# We run sgid so the game has access to both HACKDIR and user preferences.
|
||||
GAMEPERM = 02755
|
||||
VARFILEPERM = 0664
|
||||
VARDIRPERM = 0775
|
||||
|
||||
# make sure we have group GAMEUID and group GAMEGRP
|
||||
PREINSTALL= . sys/unix/hints/macosx.sh user $(GAMEUID); . sys/unix/hints/macosx.sh group $(GAMEGRP); mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
|
||||
POSTINSTALL= touch $(HACKDIR)/sysconf; $(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; $(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; chmod $(VARFILEPERM) $(HACKDIR)/sysconf
|
||||
|
||||
|
||||
# notes:
|
||||
#1) ~games/games is owned by root.
|
||||
#2) group games exists because user games was created via Accounts pane.
|
||||
#3) who should own/be able to run recover?
|
||||
@@ -32,6 +32,7 @@ CHGRP=true
|
||||
WINSRC = $(WINX11SRC)
|
||||
WINOBJ = $(WINX11OBJ)
|
||||
WINLIB = $(WINX11LIB)
|
||||
VARDIRPERM = 0755
|
||||
|
||||
VARDATND = x11tiles NetHack.ad pet_mark.xbm
|
||||
|
||||
|
||||
57
sys/unix/hints/macosx.sh
Executable file
57
sys/unix/hints/macosx.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# SCCS Id: @(#)macosx-mu.sh 3.5 2007/12/12
|
||||
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
|
||||
# NetHack may be freely redistributed. See license for details.
|
||||
#
|
||||
# hints helper script for macosx
|
||||
# DO NOT invoke directly
|
||||
|
||||
cmd=$1
|
||||
|
||||
case "x$cmd" in
|
||||
xuser)
|
||||
user=$2
|
||||
gotuser=`niutil -readval . /users/$user name 0 2>/dev/null`
|
||||
[ -z $gotuser ] && (echo "User $user does not exist."
|
||||
exit 1;
|
||||
)
|
||||
exit 0
|
||||
;;
|
||||
#name: dummy1
|
||||
#_writers_passwd: dummy1
|
||||
#_writers_tim_password: dummy1
|
||||
#_writers_picture: dummy1
|
||||
#home: /Users/dummy1
|
||||
#gid: 504
|
||||
#picture: /Library/User Pictures/Animals/Dragonfly.tif
|
||||
#uid: 504
|
||||
#hint: dummy1
|
||||
#_writers_hint: dummy1
|
||||
#sharedDir:
|
||||
#_shadow_passwd:
|
||||
#_writers_realname: dummy1
|
||||
#shell: /bin/bash
|
||||
#passwd: ********
|
||||
#authentication_authority: ;ShadowHash;
|
||||
#realname: dummyname1
|
||||
#generateduid: F6D4991C-BDF5-481F-A407-D84C6A2D0E2A
|
||||
xgroup)
|
||||
group=$2
|
||||
gotgrp=`niutil -readval . /groups/$group name 0 2>/dev/null`
|
||||
[ -z $gotgrp ] && ( echo "Group $group does not exist."
|
||||
exit 1
|
||||
)
|
||||
exit 0
|
||||
;;
|
||||
#niutil -read . /groups/bin name 0
|
||||
#name: bin
|
||||
#gid: 7
|
||||
#passwd: *
|
||||
#generateduid: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000007
|
||||
#smb_sid: S-1-5-21-107
|
||||
#realname: Binary
|
||||
|
||||
*) echo "Unknown command $cmd"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -23,3 +23,10 @@ WINTTYLIB=-ltermlib
|
||||
|
||||
CHOWN=chown
|
||||
CHGRP=chgrp
|
||||
|
||||
GAMEUID = games
|
||||
GAMEGRP = bin
|
||||
|
||||
GAMEPERM = 04755
|
||||
VARFILEPERM = 0644
|
||||
VARDIRPERM = 0755
|
||||
|
||||
@@ -128,6 +128,11 @@ char *argv[];
|
||||
if (!strncmp(argv[1], "-s", 2) && strncmp(argv[1], "-style", 6)) {
|
||||
#ifdef CHDIR
|
||||
chdirx(dir,0);
|
||||
#endif
|
||||
#ifdef SYSCF
|
||||
initoptions_init();
|
||||
read_config_file(SYSCF_FILE, SET_IN_SYS);
|
||||
initoptions_finish();
|
||||
#endif
|
||||
prscore(argc, argv);
|
||||
exit(EXIT_SUCCESS);
|
||||
@@ -148,7 +153,11 @@ char *argv[];
|
||||
#ifdef __linux__
|
||||
check_linux_console();
|
||||
#endif
|
||||
initoptions();
|
||||
initoptions_init();
|
||||
#ifdef SYSCF
|
||||
read_config_file(SYSCF_FILE, SET_IN_SYS);
|
||||
#endif
|
||||
initoptions_finish();
|
||||
exact_username = whoami();
|
||||
|
||||
/*
|
||||
@@ -530,6 +539,22 @@ authorize_wizard_mode()
|
||||
pw = getpwuid(uid);
|
||||
}
|
||||
}
|
||||
#ifdef SYSCF
|
||||
if (pw && wizards[0]) {
|
||||
if(wizards[0] == '*') return TRUE; /*allow any user to be wizard*/
|
||||
int pwlen = strlen(pw->pw_name);
|
||||
char *eop = eos(wizards);
|
||||
char *w = wizards;
|
||||
while( w+pwlen <= eop ){
|
||||
if( ! *w ) break;
|
||||
if( isspace(*w) ){ w++; continue;}
|
||||
if( !strncmp(w, pw->pw_name, pwlen) ){
|
||||
if( !w[pwlen] || isspace(w[pwlen]) ) return TRUE;
|
||||
}
|
||||
while( *w && !isspace(*w) ) w++;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (pw && !strcmp(pw->pw_name, WIZARD_NAME)) return TRUE;
|
||||
#endif /* WIZARD */
|
||||
return FALSE;
|
||||
|
||||
Reference in New Issue
Block a user