diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-03-14 02:07:32 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-03-14 02:07:32 +0000 |
commit | 393639ac4bfe746616975c047621e9f23685a265 (patch) | |
tree | e785af70cf2b04c307c6bb33d57413d14ed933e7 /games/hunt | |
parent | 3542ea2f40d06595caca713f2e1db02f9e8f28c3 (diff) |
Access control works now; also, some minor tidying and man page fixes.
Diffstat (limited to 'games/hunt')
-rw-r--r-- | games/hunt/Makefile.inc | 3 | ||||
-rw-r--r-- | games/hunt/hunt/Makefile | 5 | ||||
-rw-r--r-- | games/hunt/hunt/hunt.6 | 46 | ||||
-rw-r--r-- | games/hunt/hunt/hunt.c | 6 | ||||
-rw-r--r-- | games/hunt/huntd/Makefile | 3 | ||||
-rw-r--r-- | games/hunt/huntd/answer.c | 3 | ||||
-rw-r--r-- | games/hunt/huntd/driver.c | 27 | ||||
-rw-r--r-- | games/hunt/huntd/huntd.6 | 26 |
8 files changed, 60 insertions, 59 deletions
diff --git a/games/hunt/Makefile.inc b/games/hunt/Makefile.inc deleted file mode 100644 index 318bfc0a098..00000000000 --- a/games/hunt/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $OpenBSD: Makefile.inc,v 1.3 1999/01/29 07:30:33 d Exp $ - -.include "../Makefile.inc" diff --git a/games/hunt/hunt/Makefile b/games/hunt/hunt/Makefile index 7e3c06b2882..e3d98aeaccf 100644 --- a/games/hunt/hunt/Makefile +++ b/games/hunt/hunt/Makefile @@ -1,15 +1,16 @@ # $NetBSD: Makefile,v 1.5 1998/02/18 22:37:31 jtc Exp $ -# $OpenBSD: Makefile,v 1.3 1999/01/29 07:30:33 d Exp $ +# $OpenBSD: Makefile,v 1.4 1999/03/14 02:07:30 pjanzen Exp $ PROG= hunt SRCS= connect.c hunt.c otto.c playit.c display.c MAN= hunt.6 LDADD= -lcurses -DPADD= ${LIBTERMCAP} ${LIBCURSES} +DPADD= ${LIBCURSES} HIDEGAME=hidegame CPPFLAGS+=-I${.CURDIR}/../huntd .PATH: ${.CURDIR}/../huntd +.include "../../Makefile.inc" .include <bsd.prog.mk> diff --git a/games/hunt/hunt/hunt.6 b/games/hunt/hunt/hunt.6 index c4c88e427f7..877a795705b 100644 --- a/games/hunt/hunt/hunt.6 +++ b/games/hunt/hunt/hunt.6 @@ -1,5 +1,5 @@ .\" $NetBSD: hunt.6,v 1.3 1997/10/10 16:32:30 lukem Exp $ -.\" $OpenBSD: hunt.6,v 1.3 1999/01/29 07:30:33 d Exp $ +.\" $OpenBSD: hunt.6,v 1.4 1999/03/14 02:07:30 pjanzen Exp $ .\" .\" hunt .\" Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold @@ -28,7 +28,7 @@ .Oc .Sh DESCRIPTION The object of the game -.Nm hunt +.Nm is to kill off the other players. There are no rooms, no treasures, and no monsters. Instead, you wander around a maze, find grenades, trip mines, and shoot down @@ -40,21 +40,23 @@ flag is given, you enter the game as a monitor (you can see the action but you cannot play). .Pp -.Nm Hunt +.Nm looks for an active game on the local network. The location of the game may be specified by giving the .Ar host argument. -This presupposes that a hunt game is already running on that host, see +This presupposes that a hunt game is already running on that host: see .Xr huntd 6 -for details on how to setup a game on a specific host. -If more than one game if found, -you may pick which game to play in. +for details on how to set up a game on a specific host. +If more than one game is found, you may pick which game to play in. +If no games are found, +.Nm +will exit. .Pp If the .Fl q flag is given, -.Nm hunt +.Nm queries the local network (or specific host) and reports on all active games found. This is useful for shell startup scripts, e.g., csh's @@ -69,7 +71,7 @@ The .Fl s , and .Fl f -options are for entering the game cloaked, scanning, or flying respectively. +options are for entering the game cloaked, scanning, or flying, respectively. .Pp The .Fl b @@ -77,11 +79,11 @@ option turns off beeping when you reach the typeahead limit. .Pp The .Fl t -option aids team playing by making everyone else on one's team +option aids team play by making everyone else on your team appear as the team name. A team name is a single digit to avoid conflicting with other characters used in the game. -Use a team name constsiting of a single space +Use a team name consisting of a single space .Pq Sq \ to remain on your own. .Pp @@ -89,8 +91,6 @@ The .Fl p .Ar port option allows the rendezvous port number to be set. -This is a useful way for people playing on dialup lines to avoid playing -with people on 9600 baud terminals. .Pp The .Fl w @@ -104,12 +104,12 @@ When you die and are asked if you wish to re-enter the game, there are other answers than just yes or no. You can also reply with a .Ic w -for write a message before continuing or +to write a message before continuing or .Ic o to change how you enter the game (cloaked, scanning, or flying). .Sh "PLAYING HINTS" -.Nm Hunt -only works on crt (vdt) terminals with at least 24 lines, 80 columns, and +.Nm +only works on terminals with at least 24 lines, 80 columns, and cursor addressing. The screen is divided in to 3 areas. On the right hand side is the status area. @@ -127,7 +127,7 @@ The rest of the screen is taken up by your map of the maze. The 24th line is used for longer messages that don't fit in the status area. .Pp -.Nm Hunt +.Nm uses the same keys to move as .Xr vi 1 does, i.e., @@ -211,7 +211,7 @@ small slime big slime .br .It Li > < ^ v -you facing right, left, up, or down +you, facing right, left, up, or down .It Li } { i ! other players facing right, left, up, or down .It \&* @@ -227,7 +227,7 @@ Other helpful hints: .It You can only fire in the direction you are facing. .It -You can only fire three shots in a row, then the gun must cool off. +You can only fire three shots in a row before the gun must cool off. .It Shots move 5 times faster than you do. .It @@ -249,7 +249,7 @@ do the most damage in the center. Slime affects all squares it oozes over. The number of squares is equal to the number of charges used. .It -One small mine and one large mine is placed in the maze for every new player. +One small mine and one large mine are placed in the maze for every new player. A mine has a 2% probability of tripping when you walk forward on to it; 50% when going sideways; 95% when backing up. @@ -308,7 +308,7 @@ The environment variable .Ev HUNT is checked to get the player name. If you don't have this variable set, -.Nm hunt +.Nm will ask you what name you want to play under. If you wish to set other options than just your name, you can enumerate the options as follows: @@ -346,10 +346,10 @@ of times you entered the game and is only kept for the duration of a single session of .Nm hunt . .Pp -.Nm Hunt +.Nm normally drives up the load average to be approximately (number_of_players + 0.5) greater than it would be without a -.Nm hunt +.Nm game executing. .Sh STATISTICS The diff --git a/games/hunt/hunt/hunt.c b/games/hunt/hunt/hunt.c index a573dbfcb8e..46934da605e 100644 --- a/games/hunt/hunt/hunt.c +++ b/games/hunt/hunt/hunt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hunt.c,v 1.4 1999/02/01 06:53:55 d Exp $ */ +/* $OpenBSD: hunt.c,v 1.5 1999/03/14 02:07:30 pjanzen Exp $ */ /* $NetBSD: hunt.c,v 1.8 1998/09/13 15:27:28 hubertf Exp $ */ /* * Hunt @@ -29,10 +29,6 @@ #include "client.h" -/* - * Some old versions of curses don't have these defined - */ - FLAG Am_monitor = FALSE; int Socket; char map_key[256]; /* what to map keys to */ diff --git a/games/hunt/huntd/Makefile b/games/hunt/huntd/Makefile index 344bf2fff02..d096bd8f9f1 100644 --- a/games/hunt/huntd/Makefile +++ b/games/hunt/huntd/Makefile @@ -1,5 +1,5 @@ # $NetBSD: Makefile,v 1.1 1997/10/04 09:11:21 mrg Exp $ -# $OpenBSD: Makefile,v 1.3 1999/01/29 07:30:34 d Exp $ +# $OpenBSD: Makefile,v 1.4 1999/03/14 02:07:30 pjanzen Exp $ PROG= huntd SRCS= answer.c conf.c draw.c driver.c execute.c expl.c \ @@ -8,4 +8,5 @@ MAN= huntd.6 LDADD+= -lwrap DPADD+= ${LIBWRAP} +.include "../../Makefile.inc" .include <bsd.prog.mk> diff --git a/games/hunt/huntd/answer.c b/games/hunt/huntd/answer.c index e5e360afe86..f45b16d8c47 100644 --- a/games/hunt/huntd/answer.c +++ b/games/hunt/huntd/answer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: answer.c,v 1.4 1999/02/01 06:53:55 d Exp $ */ +/* $OpenBSD: answer.c,v 1.5 1999/03/14 02:07:30 pjanzen Exp $ */ /* $NetBSD: answer.c,v 1.3 1997/10/10 16:32:50 lukem Exp $ */ /* * Hunt @@ -55,6 +55,7 @@ answer_first() /* Check for access permissions: */ request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, newsock, 0); + fromhost(&ri); if (hosts_access(&ri) == 0) { close(newsock); logx(LOG_INFO, "rejected connection"); diff --git a/games/hunt/huntd/driver.c b/games/hunt/huntd/driver.c index a33b68ebfa8..1e1fbdd28e7 100644 --- a/games/hunt/huntd/driver.c +++ b/games/hunt/huntd/driver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: driver.c,v 1.4 1999/02/01 06:53:56 d Exp $ */ +/* $OpenBSD: driver.c,v 1.5 1999/03/14 02:07:30 pjanzen Exp $ */ /* $NetBSD: driver.c,v 1.5 1997/10/20 00:37:16 lukem Exp $ */ /* * Hunt @@ -589,11 +589,11 @@ checkdam(victim, attacker, credit, damage, shot_type) if (attacker->p_damage < 0) attacker->p_damage = 0; - /* Tell the attacker's his new strength: */ + /* Tell the attacker his new strength: */ outyx(attacker, STAT_DAM_ROW, STAT_VALUE_COL, "%2d/%2d", attacker->p_damage, attacker->p_damcap); - /* Tell the attacker's his new 'kill count': */ + /* Tell the attacker his new 'kill count': */ outyx(attacker, STAT_KILL_ROW, STAT_VALUE_COL, "%3d", (attacker->p_damcap - conf_maxdam) / 2); @@ -948,12 +948,13 @@ send_stats() return; } - /* Check for access permissions: */ - request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, s, 0); - if (hosts_access(&ri) == 0) { - close(s); - return; - } + /* Check for access permissions: */ + request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, s, 0); + fromhost(&ri); + if (hosts_access(&ri) == 0) { + close(s); + return; + } fp = fdopen(s, "w"); if (fp == NULL) { @@ -1073,13 +1074,21 @@ handle_wkport(fd) int fromlen; u_int16_t query; u_int16_t response; + struct request_info ri; + request_init(&ri, RQ_DAEMON, "huntd", RQ_FILE, fd, 0); + fromhost(&ri); fromlen = sizeof fromaddr; if (recvfrom(fd, &query, sizeof query, 0, &fromaddr, &fromlen) == -1) { log(LOG_WARNING, "recvfrom"); return; } + + /* Do we allow access? */ + if (hosts_access(&ri) == 0) + return; + query = ntohs(query); switch (query) { diff --git a/games/hunt/huntd/huntd.6 b/games/hunt/huntd/huntd.6 index e85a6261a8c..65bb168de6b 100644 --- a/games/hunt/huntd/huntd.6 +++ b/games/hunt/huntd/huntd.6 @@ -1,5 +1,5 @@ .\" $NetBSD: huntd.6,v 1.3 1998/01/09 08:03:42 perry Exp $ -.\" $OpenBSD: huntd.6,v 1.4 1999/02/01 06:53:56 d Exp $ +.\" $OpenBSD: huntd.6,v 1.5 1999/03/14 02:07:31 pjanzen Exp $ .\" .\" Hunt .\" Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold @@ -21,7 +21,7 @@ .Op Fl p Ar port .Op Fl a Ar addr .Sh DESCRIPTION -.Nm huntd +.Nm controls the multi-player .Xr hunt 6 game. @@ -29,7 +29,7 @@ game. The .Fl s option is for running -.Nm huntd +.Nm forever (server mode). This is similar to running it under the control of .Xr inetd 8 @@ -39,7 +39,8 @@ but it consumes a process table entry when no one is playing. The .Fl p Ar port option changes the udp port number used to rendezvous with the player -process and thus allows for private games of hunt. +process and thus allows for private games of +.Xr hunt 6 . .Pp The .Fl a Ar addr @@ -50,7 +51,7 @@ must be given as an IP address. .Sh INETD .Pp To run -.Nm huntd +.Nm from .Xr inetd 8 , you'll need to put the @@ -80,21 +81,16 @@ If a hears the request, it sends back the port number for the .Nm hunt process to connect to. -Otherwise, the -.Nm hunt -process starts up a -.Nm huntd -on the local machine and trys to rendezvous with it. .Pp Regardless of how -.Nm huntd +.Nm is started, it always checks incoming connections with .Xr host_access 5 , using a service name of .Sq huntd . .Sh "CONFIGURATION" When -.Nm huntd +.Nm starts, it looks for configuration files that determine game parameters. Each line of a configuration file is of the form @@ -147,11 +143,11 @@ max displacement each flying time unit (default 5) .It volcano_max max size of volcano (default 50) .It ptrip_face -chace of tripping a grenade on pickup, (default 2) +chance of tripping a grenade on pickup (default 2) .It ptrip_back -\&" when backing onto it (default 95) +chance of same when backing onto it (default 95) .It ptrip_side -\&" when walking sideways into it (default 50) +chance of same when walking sideways into it (default 50) .It prandom percentage of time dispersion doors appear (default 1) .It preflect |