From owner-freebsd-bugs Sun Feb 18 14:10: 8 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 5B84637B401 for ; Sun, 18 Feb 2001 14:10:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f1IMA2O99288; Sun, 18 Feb 2001 14:10:02 -0800 (PST) (envelope-from gnats) Date: Sun, 18 Feb 2001 14:10:02 -0800 (PST) Message-Id: <200102182210.f1IMA2O99288@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Philipp Mergenthaler Subject: Re: i386/23562: telnetd doesn't show message in file specified by if in gettytab Reply-To: Philipp Mergenthaler Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR i386/23562; it has been noted by GNATS. From: Philipp Mergenthaler To: freebsd-gnats-submit@FreeBSD.org, tanes73@yahoo.com Cc: Subject: Re: i386/23562: telnetd doesn't show message in file specified by if in gettytab Date: Sun, 18 Feb 2001 23:06:25 +0100 Hi, the following patch adds the "issue file" capability to the telnetd in the crypto source tree. It is almost identical to this commit: http://www.freebsd.org/cgi/cvsweb.cgi/src/libexec/telnetd/telnetd.c#rev1.14 (This patch also initializes altlogin to NULL. Without this, there can be crashes in start_login() in sys_term.c. They only seem to occur when telnetd is run with option -debug, though.) Bye, Philipp diff -u telnetd/telnetd.8 telnetd.new/telnetd.8 --- telnetd/telnetd.8 Sun Feb 4 11:44:19 2001 +++ telnetd.new/telnetd.8 Sun Feb 18 19:26:49 2001 @@ -527,10 +527,34 @@ indicates a willingness to decrypt the data stream. .El -.Sh ENVIRONMENT +.Sh NOTES +By default +.Nm +will read the +.Em \&he , +.Em \&hn , +and +.Em \&im +capabilities from +.Pa /etc/gettytab +and use that information (if present) to determine +what to display before the login: prompt. You can +also use a System V style +.Pa /etc/issue +file by using the +.Em \&if +capability, which will override +.Em \&im . +The information specified in either +.Em \&im +or +.Em \&if +will be displayed to both console and remote logins. +.\" .Sh ENVIRONMENT .Sh FILES .Bl -tag -width /usr/ucb/bftp -compact .It Pa /etc/services +.It Pa /etc/gettytab .It Pa /etc/inittab (UNICOS systems only) .It Pa /etc/iptos @@ -541,6 +565,7 @@ .Sh "SEE ALSO" .Xr bftp 1 , .Xr login 1 , +.Xr gettytab 5 , .Xr telnet 1 (if supported) .Sh STANDARDS diff -u telnetd/telnetd.c telnetd.new/telnetd.c --- telnetd/telnetd.c Wed Feb 7 20:45:07 2001 +++ telnetd.new/telnetd.c Sun Feb 18 14:48:05 2001 @@ -60,6 +60,7 @@ #include #include +#include #include #include @@ -149,7 +150,7 @@ int debug = 0; int keepalive = 1; -char *altlogin; +char *altlogin = NULL; void doit __P((struct sockaddr *)); int terminaltypeok __P((char *)); @@ -958,6 +959,11 @@ char *HE; char *HN; char *IM; + char *IF; + char *if_buf; + int if_fd; + struct stat statbuf; + void netflush(); int nfd; @@ -1157,8 +1163,11 @@ HE = Getstr("he", &cp); HN = Getstr("hn", &cp); IM = Getstr("im", &cp); + IF = Getstr("if", &cp); if (HN && *HN) (void) strlcpy(host_name, HN, sizeof(host_name)); + if (IF && (if_fd = open(IF, O_RDONLY, 000)) != -1) + IM = 0; if (IM == 0) IM = ""; } else { @@ -1168,6 +1177,14 @@ 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); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message