From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: alt.sources Subject: Unofficial patches to talk for RFC 931 support Message-ID: <19568:Feb709:49:5291@kramden.acf.nyu.edu> Date: 7 Feb 91 09:49:52 GMT These are unofficial patches to BSD 4.3 talk (the version on gatekeeper.dec.com). They change the ``Connection established'' message to ``Connection established to user@host, authenticating...'', which rapidly changes to ``Connection established to user@host (user@host)''. The first user@host is what you typed; the second one uses RFC 931 to authenticate the connection, and will detect spoofs in what is otherwise a quite insecure system. If the remote system doesn't support RFC 931, talk will report ``unknown@host'' for the second ID. These patches require the authuser library, part of the authd package posted here recently. ---Dan *** Makefile.old Wed Sep 28 01:28:11 1988 --- Makefile Thu Feb 7 04:14:31 1991 *************** *** 27,33 **** all: talk talk: ${OBJS} ${LIBC} ! ${CC} -o $@ ${CFLAGS} ${OBJS} -lcurses -ltermlib clean: rm -f ${OBJS} core talk --- 27,33 ---- all: talk talk: ${OBJS} ${LIBC} ! ${CC} -o $@ ${CFLAGS} ${OBJS} -lcurses -ltermlib -lauthuser clean: rm -f ${OBJS} core talk *** io.c.old Thu Feb 7 03:46:13 1991 --- io.c Thu Feb 7 04:34:16 1991 *************** *** 29,34 **** --- 29,38 ---- #include #include #include + #include + #include + #include + extern char *auth_tcpuser(); #define A_LONG_TIME 10000000 #define STDIN_MASK (1<h_addr, (char *)&my_machine_addr, hp->h_length); --- 32,38 ---- /* look up the address of the local host */ hp = gethostbyname(my_machine_name); if (hp == NULL) { ! fprintf(stderr, "talk: %s: unknown host\n", my_machine_name); exit(-1); } bcopy(hp->h_addr, (char *)&my_machine_addr, hp->h_length); *************** *** 44,51 **** if (strcmp(his_machine_name, my_machine_name)) { hp = gethostbyname(his_machine_name); if (hp == NULL) { ! fprintf(stderr, "talk: %s: ", his_machine_name); ! herror((char *)NULL); exit(-1); } bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length); --- 43,49 ---- if (strcmp(his_machine_name, my_machine_name)) { hp = gethostbyname(his_machine_name); if (hp == NULL) { ! fprintf(stderr, "talk: %s: unknown host\n", his_machine_name); exit(-1); } bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length); *** get_names.c.old Wed Jun 29 23:22:35 1988 --- get_names.c Thu Feb 7 04:32:01 1991 *************** *** 29,34 **** --- 29,37 ---- char *rindex(); extern CTL_MSG msg; + extern char *remname; /* to print after Connection established */ + extern char *remhost; + /* * Determine the local and remote user, tty, and machines */ *************** *** 66,82 **** ; if (*cp == '\0') { /* this is a local to local talk */ ! his_name = argv[1]; his_machine_name = my_machine_name; } else { if (*cp++ == '@') { /* user@host */ ! his_name = argv[1]; ! his_machine_name = cp; } else { /* host.user or host!user or host:user */ ! his_name = cp; ! his_machine_name = argv[1]; } *--cp = '\0'; } --- 69,86 ---- ; if (*cp == '\0') { /* this is a local to local talk */ ! remname = his_name = argv[1]; his_machine_name = my_machine_name; + remhost = 0; } else { if (*cp++ == '@') { /* user@host */ ! remname = his_name = argv[1]; ! remhost = his_machine_name = cp; } else { /* host.user or host!user or host:user */ ! remname = his_name = cp; ! remhost = his_machine_name = argv[1]; } *--cp = '\0'; }