Date: Sun, 3 May 1998 09:33:18 GMT From: Studded@san.rr.com To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/6492: telnetd "/etc/issue-like" support Message-ID: <199805030933.JAA03244@dt050n33.san.rr.com>
next in thread | raw e-mail | index | archive | help
>Number: 6492 >Category: bin >Synopsis: telnetd support for an /etc/issue file and bug fix >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun May 3 02:40:01 PDT 1998 >Last-Modified: >Originator: Doug >Organization: AAAG >Release: FreeBSD 2.2.6-STABLE-0502 i386 >Environment: -Stable and -Current >Description: Support for reading the "if" file from /etc/gettytab was included in -Current on 4/26/98 but not -Stable. A simple diff between -Current and -Stable applies, compiles and runs cleanly so I'd like to encourage someone to commit it. In addition, while testing that facility it became apparent that when telnetd printed it to the remote terminal it was missing a \r. This causes the file to be printed out with the dreaded stairstep effect. The supplied patch to utility.c (in the telnetd directory) should be applied to both -Current and -Stable. >How-To-Repeat: For -Current, create a multi-line file referenced with the "if=" option in /etc/gettytab. Telnet in from a remote site and watch the file stairstep across the terminal. :) >Fix: Apply the following patches: This one is straight from CVS, only needed on -Stable diff -p -u -r1.7.2.4 -r1.14 --- src/libexec/telnetd/telnetd.c 1998/03/06 01:47:55 1.7.2.4 HEAD +++ /home/ncvs/src/libexec/telnetd/telnetd.c 1998/04/26 06:51:36 1.14 @@ -42,7 +42,7 @@ static const char copyright[] = static char sccsid[] = "@(#)telnetd.c 8.2 (Berkeley) 12/15/93"; #endif static const char rcsid[] = - "$Id: telnetd.c,v 1.7.2.4 1998/03/06 01:47:55 jkh Exp $"; + "$Id: telnetd.c,v 1.14 1998/03/06 01:47:55 jkh Exp $"; #endif /* not lint */ #include "telnetd.h" @@ -60,6 +60,8 @@ static const char rcsid[] = #include <err.h> #include <arpa/inet.h> +#include <sys/mman.h> + #if defined(_SC_CRAY_SECURE_SYS) #include <sys/sysv.h> #include <sys/secdev.h> @@ -892,6 +894,11 @@ telnet(f, p, host) char *HE; char *HN; char *IM; + char *IF; + char *if_buf; + int if_fd; + struct stat statbuf; + void netflush(); /* @@ -1090,8 +1097,11 @@ telnet(f, p, host) HE = getstr("he", &cp); HN = getstr("hn", &cp); IM = getstr("im", &cp); + IF = getstr("if", &cp); if (HN && *HN) (void) strcpy(host_name, HN); + if (IF && (if_fd = open(IF, O_RDONLY, 000)) != -1) + IM = 0; if (IM == 0) IM = ""; } else { @@ -1101,6 +1111,14 @@ telnet(f, p, host) edithost(HE, host_name); if (hostinfo && *IM) putf(IM, ptyibuf2); + else if (IF && if_fd != -1) { + fstat (if_fd, &statbuf); + if_buf = (char *) mmap (0, statbuf.st_size, PROT_READ, + 0, if_fd, 0); + putf(if_buf, ptyibuf2); + munmap (if_buf, statbuf.st_size); + close (if_fd); + } if (pcc) (void) strncat(ptyibuf2, ptyip, pcc+1); This one should be attributed to Chip Norkus and applied to both branches: --- utility.c.Dist Sun May 3 01:36:55 1998 +++ utility.c Sun May 3 01:57:41 1998 @@ -441,7 +441,12 @@ putlocation = where; while (*cp) { - if (*cp != '%') { + if (*cp =='\n') { + putstr("\r\n"); + cp++; + continue; + } + else if (*cp != '%') { putchr(*cp++); continue; } >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199805030933.JAA03244>