From fb128913a9ad20997bc7e5ff2afa5ae8470dacde Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Tue, 13 Aug 1996 07:53:54 +0000 Subject: [PATCH] Same as non-secure telnetd, add support for ``-P altlogin'' to specify an alternate /usr/bin/login type program to be run. --- eBones/libexec/telnetd/sys_term.c | 12 +++++++++--- eBones/libexec/telnetd/telnetd.8 | 6 ++++++ eBones/libexec/telnetd/telnetd.c | 7 ++++++- secure/libexec/telnetd/sys_term.c | 12 +++++++++--- secure/libexec/telnetd/telnetd.8 | 6 ++++++ secure/libexec/telnetd/telnetd.c | 7 ++++++- 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/eBones/libexec/telnetd/sys_term.c b/eBones/libexec/telnetd/sys_term.c index 87db5745a838..cb8245fb78fe 100644 --- a/eBones/libexec/telnetd/sys_term.c +++ b/eBones/libexec/telnetd/sys_term.c @@ -42,6 +42,8 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95"; #include #endif +extern char *altlogin; + #if defined(CRAY) || defined(__hpux) # define PARENT_DOES_UTMP #endif @@ -1781,10 +1783,14 @@ start_login(host, autologin, name) close(pty); #endif closelog(); - execv(_PATH_LOGIN, argv); - syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN); - fatalperror(net, _PATH_LOGIN); + if (altlogin == NULL) { + altlogin = _PATH_LOGIN; + } + execv(altlogin, argv); + + syslog(LOG_ERR, "%s: %m\n", altlogin); + fatalperror(net, altlogin); /*NOTREACHED*/ } diff --git a/eBones/libexec/telnetd/telnetd.8 b/eBones/libexec/telnetd/telnetd.8 index f618385ed09b..846189ddf4ba 100644 --- a/eBones/libexec/telnetd/telnetd.8 +++ b/eBones/libexec/telnetd/telnetd.8 @@ -48,6 +48,7 @@ protocol server .Op Fl X Ar authtype .Op Fl a Ar authmode .Op Fl edebug +.Op Fl P Ar loginprog .Op Fl r Ns Ar lowpty-highpty .Op Fl u Ar len .Op Fl debug Op Ar port @@ -187,6 +188,11 @@ If has been compiled with support for data encryption, then the .Fl edebug option may be used to enable encryption debugging code. +.It Fl P Ar loginprog +Specifies an alternate +.Xr login 1 +command to run to complete the login. The alternate command must +understand the same command arguments as the standard login. .It Fl h Disables the printing of host-specific information before login has been completed. diff --git a/eBones/libexec/telnetd/telnetd.c b/eBones/libexec/telnetd/telnetd.c index 707c68ad6fe9..40fdad50ef85 100644 --- a/eBones/libexec/telnetd/telnetd.c +++ b/eBones/libexec/telnetd/telnetd.c @@ -124,6 +124,7 @@ int lowpty = 0, highpty; /* low, high pty numbers */ int debug = 0; int keepalive = 1; char *progname; +char *altlogin; extern void usage P((void)); @@ -133,7 +134,7 @@ extern void usage P((void)); * passed off to getopt(). */ char valid_opts[] = { - 'd', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U', + 'd', ':', 'h', 'k', 'n', 'p', ':', 'S', ':', 'u', ':', 'U', #ifdef AUTHENTICATION 'a', ':', 'X', ':', #endif @@ -301,6 +302,10 @@ main(argc, argv) keepalive = 0; break; + case 'p': + altlogin = optarg; + break; + #ifdef CRAY case 'r': { diff --git a/secure/libexec/telnetd/sys_term.c b/secure/libexec/telnetd/sys_term.c index 87db5745a838..cb8245fb78fe 100644 --- a/secure/libexec/telnetd/sys_term.c +++ b/secure/libexec/telnetd/sys_term.c @@ -42,6 +42,8 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95"; #include #endif +extern char *altlogin; + #if defined(CRAY) || defined(__hpux) # define PARENT_DOES_UTMP #endif @@ -1781,10 +1783,14 @@ start_login(host, autologin, name) close(pty); #endif closelog(); - execv(_PATH_LOGIN, argv); - syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN); - fatalperror(net, _PATH_LOGIN); + if (altlogin == NULL) { + altlogin = _PATH_LOGIN; + } + execv(altlogin, argv); + + syslog(LOG_ERR, "%s: %m\n", altlogin); + fatalperror(net, altlogin); /*NOTREACHED*/ } diff --git a/secure/libexec/telnetd/telnetd.8 b/secure/libexec/telnetd/telnetd.8 index f618385ed09b..846189ddf4ba 100644 --- a/secure/libexec/telnetd/telnetd.8 +++ b/secure/libexec/telnetd/telnetd.8 @@ -48,6 +48,7 @@ protocol server .Op Fl X Ar authtype .Op Fl a Ar authmode .Op Fl edebug +.Op Fl P Ar loginprog .Op Fl r Ns Ar lowpty-highpty .Op Fl u Ar len .Op Fl debug Op Ar port @@ -187,6 +188,11 @@ If has been compiled with support for data encryption, then the .Fl edebug option may be used to enable encryption debugging code. +.It Fl P Ar loginprog +Specifies an alternate +.Xr login 1 +command to run to complete the login. The alternate command must +understand the same command arguments as the standard login. .It Fl h Disables the printing of host-specific information before login has been completed. diff --git a/secure/libexec/telnetd/telnetd.c b/secure/libexec/telnetd/telnetd.c index 707c68ad6fe9..40fdad50ef85 100644 --- a/secure/libexec/telnetd/telnetd.c +++ b/secure/libexec/telnetd/telnetd.c @@ -124,6 +124,7 @@ int lowpty = 0, highpty; /* low, high pty numbers */ int debug = 0; int keepalive = 1; char *progname; +char *altlogin; extern void usage P((void)); @@ -133,7 +134,7 @@ extern void usage P((void)); * passed off to getopt(). */ char valid_opts[] = { - 'd', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U', + 'd', ':', 'h', 'k', 'n', 'p', ':', 'S', ':', 'u', ':', 'U', #ifdef AUTHENTICATION 'a', ':', 'X', ':', #endif @@ -301,6 +302,10 @@ main(argc, argv) keepalive = 0; break; + case 'p': + altlogin = optarg; + break; + #ifdef CRAY case 'r': {