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/huntd | |
parent | 3542ea2f40d06595caca713f2e1db02f9e8f28c3 (diff) |
Access control works now; also, some minor tidying and man page fixes.
Diffstat (limited to 'games/hunt/huntd')
-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 |
4 files changed, 33 insertions, 26 deletions
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 |