apply Thorsten's patch to add gettytab support to telnetd.

This commit is contained in:
tls 1996-03-20 04:25:53 +00:00
parent 69a70ec129
commit 9f01fb5000
3 changed files with 35 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_term.c,v 1.8 1996/02/28 20:38:21 thorpej Exp $ */
/* $NetBSD: sys_term.c,v 1.9 1996/03/20 04:25:53 tls Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: sys_term.c,v 1.8 1996/02/28 20:38:21 thorpej Exp $";
static char rcsid[] = "$NetBSD: sys_term.c,v 1.9 1996/03/20 04:25:53 tls Exp $";
#endif
#endif /* not lint */
@ -1554,6 +1554,13 @@ start_login(host, autologin, name)
register char **argv;
char **addarg();
extern char *getenv();
extern char *getstr();
extern char *gettyname;
#define TABBUFSIZ 512
char defent[TABBUFSIZ];
char defstrs[TABBUFSIZ];
#undef TABBUFSIZ
char *loginprog;
#ifdef UTMPX
register int pid = getpid();
struct utmpx utmpx;
@ -1775,6 +1782,13 @@ start_login(host, autologin, name)
if (pty > 2)
close(pty);
#endif
if (getent(defent, gettyname) == 1) {
char *cp = defstrs;
loginprog = getstr("lo", &cp);
}
if (loginprog == NULL)
loginprog = _PATH_LOGIN;
closelog();
/*
* This sleep(1) is in here so that telnetd can
@ -1782,10 +1796,10 @@ start_login(host, autologin, name)
* the login banner message gets lost...
*/
sleep(1);
execv(_PATH_LOGIN, argv);
execv(loginprog, argv);
syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN);
fatalperror(net, _PATH_LOGIN);
syslog(LOG_ERR, "%s: %m\n", loginprog);
fatalperror(net, loginprog);
/*NOTREACHED*/
}

View File

@ -1,4 +1,4 @@
.\" $NetBSD: telnetd.8,v 1.7 1996/02/28 20:30:33 thorpej Exp $
.\" $NetBSD: telnetd.8,v 1.8 1996/03/20 04:25:55 tls Exp $
.\"
.\" Copyright (c) 1983, 1993
.\" The Regents of the University of California. All rights reserved.
@ -50,6 +50,7 @@ protocol server
.Op Fl X Ar authtype
.Op Fl a Ar authmode
.Op Fl edebug
.Op Fl g Ar gettyent
.Op Fl r Ns Ar lowpty-highpty
.Op Fl u Ar len
.Op Fl debug Op Ar port
@ -178,6 +179,12 @@ If
has been compiled with support for data encryption, then the
.Fl edebug
option may be used to enable encryption debugging code.
.It Fl g Ar gettyent
Specifies which entry from
.Pa /etc/gettytab
should be used to get banner strings, login program and
other information. The default entry is
.Dv default.
.It Fl h
Disables the printing of host-specific information before
login has been completed.

View File

@ -1,4 +1,4 @@
/* $NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $ */
/* $NetBSD: telnetd.c,v 1.6 1996/03/20 04:25:57 tls Exp $ */
/*
* Copyright (c) 1989, 1993
@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
#else
static char rcsid[] = "$NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $";
static char rcsid[] = "$NetBSD: telnetd.c,v 1.6 1996/03/20 04:25:57 tls Exp $";
#endif
#endif /* not lint */
@ -132,6 +132,7 @@ int lowpty = 0, highpty; /* low, high pty numbers */
int debug = 0;
int keepalive = 1;
char *gettyname = "default";
char *progname;
extern void usage P((void));
@ -142,7 +143,7 @@ extern void usage P((void));
* passed off to getopt().
*/
char valid_opts[] = {
'd', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U',
'd', ':', 'g', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U',
#ifdef AUTHENTICATION
'a', ':', 'X', ':',
#endif
@ -261,6 +262,9 @@ main(argc, argv)
break;
#endif /* DIAGNOSTICS */
case 'g':
gettyname = optarg;
break;
case 'h':
hostinfo = 0;
@ -1104,7 +1108,7 @@ telnet(f, p, host)
hostinfo = 0;
#endif
if (getent(defent, "default") == 1) {
if (getent(defent, gettyname) == 1) {
char *getstr();
char *cp=defstrs;