Module Name:    src
Committed By:   dholland
Date:           Sat Mar 29 20:32:04 UTC 2014

Modified Files:
        src/games/hunt/huntd: Makefile faketalk.c huntd.6
Removed Files:
        src/games/hunt/huntd: ctl.c ctl_transact.c get_names.c talk_ctl.h

Log Message:
Rip out the code that broadcasts talk requests to the local
hunt-players mailing list.

In this day and age it doesn't even begin to work: even if you were to
have such a mailing list locally, sendmail wouldn't expand it for you,
the addresses you got back wouldn't be talk-requestable addresses,
talk requests don't cross NAT or firewalls safely, talk doesn't
support ipv6, and nobody runs talkd anyway.

It doesn't make sense to try to replace it with some other kind of
notify scheme either; there might still be a multiuser machine
somewhere with enough simultaneous users that broadcasting something
akin to talk requests locally might make sense, and where a nontrivial
number of the users actually play hunt, but probably not, and if so
those users are likely to be better off using wall(1) anyway. Nowadays
games will be set up by looking for people in chat or by emailing or
texting friends.

Theoretically someone could set up an internet hunt metaserver for
finding hunt games, but that would be something entirely different
anyway and I doubt there's demand.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/games/hunt/huntd/Makefile
cvs rdiff -u -r1.7 -r0 src/games/hunt/huntd/ctl.c \
    src/games/hunt/huntd/talk_ctl.h
cvs rdiff -u -r1.11 -r0 src/games/hunt/huntd/ctl_transact.c
cvs rdiff -u -r1.23 -r1.24 src/games/hunt/huntd/faketalk.c
cvs rdiff -u -r1.16 -r0 src/games/hunt/huntd/get_names.c
cvs rdiff -u -r1.10 -r1.11 src/games/hunt/huntd/huntd.6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/hunt/huntd/Makefile
diff -u src/games/hunt/huntd/Makefile:1.1 src/games/hunt/huntd/Makefile:1.2
--- src/games/hunt/huntd/Makefile:1.1	Sat Oct  4 09:11:21 1997
+++ src/games/hunt/huntd/Makefile	Sat Mar 29 20:32:04 2014
@@ -1,8 +1,8 @@
-#	$NetBSD: Makefile,v 1.1 1997/10/04 09:11:21 mrg Exp $
+#	$NetBSD: Makefile,v 1.2 2014/03/29 20:32:04 dholland Exp $
 
 PROG=	huntd
-SRCS=	answer.c ctl.c ctl_transact.c draw.c driver.c execute.c expl.c \
-	extern.c faketalk.c get_names.c makemaze.c pathname.c shots.c terminal.c
+SRCS=	answer.c draw.c driver.c execute.c expl.c \
+	extern.c faketalk.c makemaze.c pathname.c shots.c terminal.c
 MAN=	huntd.6
 
 .include <bsd.prog.mk>

Index: src/games/hunt/huntd/faketalk.c
diff -u src/games/hunt/huntd/faketalk.c:1.23 src/games/hunt/huntd/faketalk.c:1.24
--- src/games/hunt/huntd/faketalk.c:1.23	Sat Mar 29 20:16:09 2014
+++ src/games/hunt/huntd/faketalk.c	Sat Mar 29 20:32:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: faketalk.c,v 1.23 2014/03/29 20:16:09 dholland Exp $	*/
+/*	$NetBSD: faketalk.c,v 1.24 2014/03/29 20:32:04 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,209 +32,14 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: faketalk.c,v 1.23 2014/03/29 20:16:09 dholland Exp $");
+__RCSID("$NetBSD: faketalk.c,v 1.24 2014/03/29 20:32:04 dholland Exp $");
 #endif /* not lint */
 
 #include "hunt.h"
 
-#if defined(TALK_43) || defined(TALK_42)
-
-#include <sys/time.h>
-#include <sys/wait.h>
-#include <ctype.h>
-#include <netdb.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "talk_ctl.h"
-
-/* defines for fake talk message to announce start of game */
-#ifdef TALK_43
-#define MASQUERADE	"\"Hunt Game\""
-#else
-#define MASQUERADE	"HuntGame"
-#endif
-#define RENDEZVOUS	"hunt-players"
-#define ARGV0		"HUNT-ANNOUNCE"
-
-extern char *my_machine_name;
-
-static void do_announce(char *);
-void exorcise(int);
-
-/*
- * exorcise - disspell zombies
- */
-
-void
-exorcise(int dummy __unused)
-{
-	(void) wait(0);
-}
-
-/*
- * query the local SMTP daemon to expand the RENDEZVOUS mailing list
- * and fake a talk request to each address thus found.
- */
-
-void
-faketalk(void)
-{
-	struct servent *sp;
-	char buf[BUFSIZ];
-	FILE *f;
-	int service;		/* socket of service */
-	struct sockaddr_in des;	/* address of destination */
-
-	(void) signal(SIGCHLD, exorcise);
-
-	if (fork() != 0)
-		return;
-
-	(void) signal(SIGINT, SIG_IGN);
-	(void) signal(SIGPIPE, SIG_IGN);
-
-	/*
-	 * change argv so that a ps shows ARGV0
-	 */
-	setproctitle("%s", ARGV0);
-
-	/*
-	 *	initialize "talk"
-	 */
-	get_local_name(MASQUERADE);
-	open_ctl();
-
-	/*
-	 *	start fetching addresses
-	 */
-
-	if ((sp = getservbyname("smtp", NULL)) == NULL) {
-#ifdef LOG
-		syslog(LOG_ERR, "faketalk: smtp protocol not supported\n");
-#else
-		warn("faketalk: smtp protocol not supported");
-#endif
-		_exit(1);
-	}
-
-	memset(&des, 0, sizeof (des));
-	des.sin_family = AF_INET;
-	des.sin_addr = my_machine_addr;
-	des.sin_port = sp->s_port;
-
-	if ((service = socket(des.sin_family, SOCK_STREAM, 0)) < 0) {
-#ifdef LOG
-		syslog(LOG_ERR, "falktalk:  socket");
-#else
-		warn("falktalk:  socket");
-#endif
-		_exit(1);
-	}
-
-	if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) {
-#ifdef LOG
-		syslog(LOG_ERR, "faketalk:  connect");
-#else
-		warn("faketalk:  connect");
-#endif
-		_exit(1);
-	}
-	if ((f = fdopen(service, "r")) == NULL) {
-#ifdef LOG
-		syslog(LOG_ERR, "fdopen failed\n");
-#else
-		warn("faketalk:  fdopen");
-#endif
-		_exit(2);
-	}
-
-	(void) fgets(buf, BUFSIZ, f);
-	(void) snprintf(buf, sizeof(buf),
-			"HELO HuntGame@%s\r\n", my_machine_name);
-	(void) write(service, buf, strlen(buf));
-	(void) fgets(buf, BUFSIZ, f);
-	(void) snprintf(buf, sizeof(buf),
-			"EXPN %s@%s\r\n", RENDEZVOUS, my_machine_name);
-	(void) write(service, buf, strlen(buf));
-	while (fgets(buf, BUFSIZ, f) != NULL) {
-		char *s, *t;
-
-		if (buf[0] != '2' || buf[1] != '5' || buf[2] != '0')
-			break;
-		if ((s = strchr(buf + 4, '<')) == NULL)
-			s = buf + 4, t = buf + strlen(buf) - 1;
-		else {
-			s += 1;
-			if ((t = strrchr(s, '>')) == NULL)
-				t = s + strlen(s) - 1;
-			else
-				t -= 1;
-		}
-		while (isspace((unsigned char)*s))
-			s += 1;
-		if (*s == '\\')
-			s += 1;
-		while (isspace((unsigned char)*t))
-			t -= 1;
-		*(t + 1) = '\0';
-		do_announce(s);		/* construct and send talk request */
-		if (buf[3] == ' ')
-			break;
-	}
-	(void) shutdown(service, 2);
-	(void) close(service);
-	_exit(0);
-}
-
-/*
- * The msg.id's for the invitations on the local and remote machines.
- * These are used to delete the invitations.
- */
-
-static void
-do_announce(char *s)
-{
-	CTL_RESPONSE response;
-
-	get_remote_name(s);	/* setup his_machine_addr, msg.r_name */
-
-#ifdef TALK_43
-	/* XXX this is nothing like a safe cast */
-	msg.ctl_addr = *(struct talkd_sockaddr *) &ctl_addr;
-	msg.ctl_addr.sa_family = htons(msg.ctl_addr.sa_family);
-#else
-	msg.ctl_addr = ctl_addr;
-	msg.ctl_addr.sin_family = htons(msg.ctl_addr.sin_family);
-#endif
-	msg.id_num = (int) htonl((uint32_t) -1);	/* an impossible id_num */
-	ctl_transact(his_machine_addr, msg, ANNOUNCE, &response);
-	if (response.answer != SUCCESS)
-		return;
-
-	/*
-	 * Have the daemons delete the invitations now that we
-	 * have announced.
-	 */
-
-	/* we don't care if cleanup doesn't make it. */
-	msg.type = DELETE;
-	msg.id_num = (int) htonl(response.id_num);
-	daemon_addr.sin_addr = his_machine_addr;
-	if (sendto(ctl_sockt, &msg, sizeof (msg), 0,
-			(struct sockaddr *) &daemon_addr, sizeof(daemon_addr))
-			!= sizeof(msg))
-		p_error("send delete remote");
-}
-
-#else
-
 void
 faketalk(void)
 {
 	return;
 }
 
-#endif

Index: src/games/hunt/huntd/huntd.6
diff -u src/games/hunt/huntd/huntd.6:1.10 src/games/hunt/huntd/huntd.6:1.11
--- src/games/hunt/huntd/huntd.6:1.10	Tue Jul  9 09:41:30 2013
+++ src/games/hunt/huntd/huntd.6	Sat Mar 29 20:32:04 2014
@@ -1,4 +1,4 @@
-.\"	$NetBSD: huntd.6,v 1.10 2013/07/09 09:41:30 njoly Exp $
+.\"	$NetBSD: huntd.6,v 1.11 2014/03/29 20:32:04 dholland Exp $
 .\"
 .\" huntd
 .\"
@@ -31,7 +31,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 4, 2001
+.Dd March 29, 2014
 .Dt HUNTD 6
 .Os
 .Sh NAME
@@ -46,14 +46,6 @@
 controls the multi-player
 .Xr hunt 6
 game.
-When it starts up, it tries to notify all members of the
-.Em hunt-players
-mailing list (see
-.Xr sendmail 1 )
-by faking a
-.Xr talk 1
-request from user
-.Dq Hunt Game .
 .Pp
 The
 .Fl s
@@ -68,9 +60,6 @@ The
 .Fl p
 option changes the UDP port number used to rendezvous with the player
 process and thus allows for private games of hunt.
-This option turns off the notification of players on the
-.Em hunt-players
-mailing list.
 .Ss INETD
 To run
 .Nm
@@ -117,7 +106,6 @@ process starts up a
 on the local machine and tries to rendezvous with it.
 .Sh SEE ALSO
 .Xr sendmail 1 ,
-.Xr talk 1 ,
 .Xr hunt 6
 .Sh AUTHORS
 Conrad Huang, Ken Arnold, and Greg Couch;

Reply via email to