From ef66b20c1c38c380c7524dbe77f613dd418b23a9 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Tue, 23 Apr 1996 03:03:56 +0000 Subject: sync with netbsd 960418 --- libexec/telnetd/sys_term.c | 26 ++++++++++++++++++++------ libexec/telnetd/telnetd.8 | 11 +++++++++-- libexec/telnetd/telnetd.c | 14 +++++++++----- 3 files changed, 38 insertions(+), 13 deletions(-) (limited to 'libexec/telnetd') diff --git a/libexec/telnetd/sys_term.c b/libexec/telnetd/sys_term.c index f8a9a30650f..a6ef8051ba2 100644 --- a/libexec/telnetd/sys_term.c +++ b/libexec/telnetd/sys_term.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sys_term.c,v 1.3 1996/03/28 23:22:00 niklas Exp $ */ -/* $NetBSD: sys_term.c,v 1.8 1996/02/28 20:38:21 thorpej Exp $ */ +/* $OpenBSD: sys_term.c,v 1.4 1996/04/23 03:03:47 deraadt Exp $ */ +/* $NetBSD: sys_term.c,v 1.9 1996/03/20 04:25:53 tls Exp $ */ /* * Copyright (c) 1989, 1993 @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95"; static char rcsid[] = "$NetBSD: sys_term.c,v 1.8 1996/02/28 20:38:21 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: sys_term.c,v 1.3 1996/03/28 23:22:00 niklas Exp $"; +static char rcsid[] = "$OpenBSD: sys_term.c,v 1.4 1996/04/23 03:03:47 deraadt Exp $"; #endif #endif /* not lint */ @@ -1556,6 +1556,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; @@ -1777,6 +1784,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 @@ -1784,10 +1798,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*/ } diff --git a/libexec/telnetd/telnetd.8 b/libexec/telnetd/telnetd.8 index c4ff02957a8..687f08370e3 100644 --- a/libexec/telnetd/telnetd.8 +++ b/libexec/telnetd/telnetd.8 @@ -1,5 +1,5 @@ -.\" $OpenBSD: telnetd.8,v 1.3 1996/03/28 23:22:02 niklas Exp $ -.\" $NetBSD: telnetd.8,v 1.7 1996/02/28 20:30:33 thorpej Exp $ +.\" $OpenBSD: telnetd.8,v 1.4 1996/04/23 03:03:50 deraadt 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. @@ -51,6 +51,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 @@ -179,6 +180,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. diff --git a/libexec/telnetd/telnetd.c b/libexec/telnetd/telnetd.c index 43d6062e23f..f184628f446 100644 --- a/libexec/telnetd/telnetd.c +++ b/libexec/telnetd/telnetd.c @@ -1,5 +1,5 @@ -/* $OpenBSD: telnetd.c,v 1.2 1996/03/28 23:22:03 niklas Exp $ */ -/* $NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $ */ +/* $OpenBSD: telnetd.c,v 1.3 1996/04/23 03:03:55 deraadt Exp $ */ +/* $NetBSD: telnetd.c,v 1.6 1996/03/20 04:25:57 tls Exp $ */ /* * Copyright (c) 1989, 1993 @@ -45,7 +45,7 @@ static char copyright[] = static char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95"; static char rcsid[] = "$NetBSD: telnetd.c,v 1.5 1996/02/28 20:38:23 thorpej Exp $"; #else -static char rcsid[] = "$OpenBSD: telnetd.c,v 1.2 1996/03/28 23:22:03 niklas Exp $"; +static char rcsid[] = "$OpenBSD: telnetd.c,v 1.3 1996/04/23 03:03:55 deraadt Exp $"; #endif #endif /* not lint */ @@ -134,6 +134,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)); @@ -144,7 +145,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 @@ -263,6 +264,9 @@ main(argc, argv) break; #endif /* DIAGNOSTICS */ + case 'g': + gettyname = optarg; + break; case 'h': hostinfo = 0; @@ -1106,7 +1110,7 @@ telnet(f, p, host) hostinfo = 0; #endif - if (getent(defent, "default") == 1) { + if (getent(defent, gettyname) == 1) { char *getstr(); char *cp=defstrs; -- cgit v1.2.3