Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Feb 2001 14:10:02 -0800 (PST)
From:      Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: i386/23562: telnetd doesn't show message in file specified by if in gettytab
Message-ID:  <200102182210.f1IMA2O99288@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR i386/23562; it has been noted by GNATS.

From: Philipp Mergenthaler <un1i@rz.uni-karlsruhe.de>
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 <err.h>
  #include <arpa/inet.h>
  
 +#include <sys/mman.h>
  #include <libutil.h>
  #include <utmp.h>
  
 @@ -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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200102182210.f1IMA2O99288>