Same as non-secure telnetd, add support for ``-P altlogin'' to specify

an alternate /usr/bin/login type program to be run.
This commit is contained in:
Peter Wemm 1996-08-13 07:53:54 +00:00
parent 326bbdd92f
commit fb128913a9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17569
6 changed files with 42 additions and 8 deletions

View File

@ -42,6 +42,8 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#include <libtelnet/auth.h> #include <libtelnet/auth.h>
#endif #endif
extern char *altlogin;
#if defined(CRAY) || defined(__hpux) #if defined(CRAY) || defined(__hpux)
# define PARENT_DOES_UTMP # define PARENT_DOES_UTMP
#endif #endif
@ -1781,10 +1783,14 @@ start_login(host, autologin, name)
close(pty); close(pty);
#endif #endif
closelog(); closelog();
execv(_PATH_LOGIN, argv);
syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN); if (altlogin == NULL) {
fatalperror(net, _PATH_LOGIN); altlogin = _PATH_LOGIN;
}
execv(altlogin, argv);
syslog(LOG_ERR, "%s: %m\n", altlogin);
fatalperror(net, altlogin);
/*NOTREACHED*/ /*NOTREACHED*/
} }

View File

@ -48,6 +48,7 @@ protocol server
.Op Fl X Ar authtype .Op Fl X Ar authtype
.Op Fl a Ar authmode .Op Fl a Ar authmode
.Op Fl edebug .Op Fl edebug
.Op Fl P Ar loginprog
.Op Fl r Ns Ar lowpty-highpty .Op Fl r Ns Ar lowpty-highpty
.Op Fl u Ar len .Op Fl u Ar len
.Op Fl debug Op Ar port .Op Fl debug Op Ar port
@ -187,6 +188,11 @@ If
has been compiled with support for data encryption, then the has been compiled with support for data encryption, then the
.Fl edebug .Fl edebug
option may be used to enable encryption debugging code. 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 .It Fl h
Disables the printing of host-specific information before Disables the printing of host-specific information before
login has been completed. login has been completed.

View File

@ -124,6 +124,7 @@ int lowpty = 0, highpty; /* low, high pty numbers */
int debug = 0; int debug = 0;
int keepalive = 1; int keepalive = 1;
char *progname; char *progname;
char *altlogin;
extern void usage P((void)); extern void usage P((void));
@ -133,7 +134,7 @@ extern void usage P((void));
* passed off to getopt(). * passed off to getopt().
*/ */
char valid_opts[] = { char valid_opts[] = {
'd', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U', 'd', ':', 'h', 'k', 'n', 'p', ':', 'S', ':', 'u', ':', 'U',
#ifdef AUTHENTICATION #ifdef AUTHENTICATION
'a', ':', 'X', ':', 'a', ':', 'X', ':',
#endif #endif
@ -301,6 +302,10 @@ main(argc, argv)
keepalive = 0; keepalive = 0;
break; break;
case 'p':
altlogin = optarg;
break;
#ifdef CRAY #ifdef CRAY
case 'r': case 'r':
{ {

View File

@ -42,6 +42,8 @@ static char sccsid[] = "@(#)sys_term.c 8.4+1 (Berkeley) 5/30/95";
#include <libtelnet/auth.h> #include <libtelnet/auth.h>
#endif #endif
extern char *altlogin;
#if defined(CRAY) || defined(__hpux) #if defined(CRAY) || defined(__hpux)
# define PARENT_DOES_UTMP # define PARENT_DOES_UTMP
#endif #endif
@ -1781,10 +1783,14 @@ start_login(host, autologin, name)
close(pty); close(pty);
#endif #endif
closelog(); closelog();
execv(_PATH_LOGIN, argv);
syslog(LOG_ERR, "%s: %m\n", _PATH_LOGIN); if (altlogin == NULL) {
fatalperror(net, _PATH_LOGIN); altlogin = _PATH_LOGIN;
}
execv(altlogin, argv);
syslog(LOG_ERR, "%s: %m\n", altlogin);
fatalperror(net, altlogin);
/*NOTREACHED*/ /*NOTREACHED*/
} }

View File

@ -48,6 +48,7 @@ protocol server
.Op Fl X Ar authtype .Op Fl X Ar authtype
.Op Fl a Ar authmode .Op Fl a Ar authmode
.Op Fl edebug .Op Fl edebug
.Op Fl P Ar loginprog
.Op Fl r Ns Ar lowpty-highpty .Op Fl r Ns Ar lowpty-highpty
.Op Fl u Ar len .Op Fl u Ar len
.Op Fl debug Op Ar port .Op Fl debug Op Ar port
@ -187,6 +188,11 @@ If
has been compiled with support for data encryption, then the has been compiled with support for data encryption, then the
.Fl edebug .Fl edebug
option may be used to enable encryption debugging code. 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 .It Fl h
Disables the printing of host-specific information before Disables the printing of host-specific information before
login has been completed. login has been completed.

View File

@ -124,6 +124,7 @@ int lowpty = 0, highpty; /* low, high pty numbers */
int debug = 0; int debug = 0;
int keepalive = 1; int keepalive = 1;
char *progname; char *progname;
char *altlogin;
extern void usage P((void)); extern void usage P((void));
@ -133,7 +134,7 @@ extern void usage P((void));
* passed off to getopt(). * passed off to getopt().
*/ */
char valid_opts[] = { char valid_opts[] = {
'd', ':', 'h', 'k', 'n', 'S', ':', 'u', ':', 'U', 'd', ':', 'h', 'k', 'n', 'p', ':', 'S', ':', 'u', ':', 'U',
#ifdef AUTHENTICATION #ifdef AUTHENTICATION
'a', ':', 'X', ':', 'a', ':', 'X', ':',
#endif #endif
@ -301,6 +302,10 @@ main(argc, argv)
keepalive = 0; keepalive = 0;
break; break;
case 'p':
altlogin = optarg;
break;
#ifdef CRAY #ifdef CRAY
case 'r': case 'r':
{ {