From 5328a558589e6ba717ce5b6265928b5a2d08fc21 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Mon, 22 Feb 1999 23:28:29 +0000 Subject: [PATCH] * telnetd.8: Document hostname logging changes * telnetd.c: Add options to control logging of remote hostname to login(1). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11208 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/telnetd/ChangeLog | 7 ++++++ src/appl/telnet/telnetd/telnetd.8 | 13 ++++++++++- src/appl/telnet/telnetd/telnetd.c | 38 +++++++++++++++++++------------ 3 files changed, 43 insertions(+), 15 deletions(-) diff --git a/src/appl/telnet/telnetd/ChangeLog b/src/appl/telnet/telnetd/ChangeLog index b42450a17..446a99796 100644 --- a/src/appl/telnet/telnetd/ChangeLog +++ b/src/appl/telnet/telnetd/ChangeLog @@ -1,3 +1,10 @@ +Mon Feb 22 18:27:38 1999 Tom Yu + + * telnetd.8: Document hostname logging changes. + + * telnetd.c: Add options to control logging of remote hostname to + login(1). + Wed Feb 3 22:57:52 1999 Theodore Y. Ts'o * state.c: Increase size of subbufer so that we don't truncate diff --git a/src/appl/telnet/telnetd/telnetd.8 b/src/appl/telnet/telnetd/telnetd.8 index f7dadedd4..93c64ac30 100644 --- a/src/appl/telnet/telnetd/telnetd.8 +++ b/src/appl/telnet/telnetd/telnetd.8 @@ -42,8 +42,9 @@ protocol server [\fB\-edebug\fP] [\fB\-h\fP] [\fB\-I\fP\fIinitid\fP] [\fB\-l\fP] [\fB\-k\fP] [\fB\-n\fP] [\fB\-r\fP\fIlowpty-highpty\fP] [\fB\-s\fP] [\fB\-S\fP \fItos\fP] [\fB\-U\fP] [\fB\-X\fP \fIauthtype\fP] +[\fB\-u\fImaxhostlen\fP] [\fB\-i\fP] [\fB\-N\fP] [\fB\-debug\fP [\fIport\fP]] -.Sh DESCRIPTION +.SH DESCRIPTION The .B telnetd command is a server which supports the @@ -196,6 +197,9 @@ to use when init starts login sessions. The default .SM ID is fe. .TP +.B \-i +Cuases the IP address to be unconditionally passed to login(8). +.TP .B \-k This option is only useful if .B telnetd @@ -227,6 +231,9 @@ mode. If the .SM LINEMODE option is not supported, it will go into kludge linemode. .TP +.B \-N +Don't strip the local domain name for passing to login(1). +.TP .B \-n Disable .SM TCP @@ -286,6 +293,10 @@ symbolic name via the .IR gethostbyaddr (3) routine. .TP +.B \-u +.I maxhostlen +Sets the maximum hostname length passed to login(1). +.TP \fB\-X\fP \fIauthtype\fP This option is only valid if .B telnetd diff --git a/src/appl/telnet/telnetd/telnetd.c b/src/appl/telnet/telnetd/telnetd.c index fe594d36d..f3ac95595 100644 --- a/src/appl/telnet/telnetd/telnetd.c +++ b/src/appl/telnet/telnetd/telnetd.c @@ -140,6 +140,10 @@ int debug = 0; int keepalive = 1; char *progname; +int maxhostlen = 0; +int always_ip = 0; +int stripdomain = 1; + extern void usage P((void)); /* @@ -149,6 +153,7 @@ extern void usage P((void)); */ char valid_opts[] = { 'd', ':', 'h', 'k', 'L', ':', 'n', 'S', ':', 'U', + 'u', ':', 'i', 'N', #ifdef AUTHENTICATION 'a', ':', 'X', ':', #endif @@ -438,6 +443,15 @@ main(argc, argv) auth_disable_name(optarg); break; #endif /* AUTHENTICATION */ + case 'u': + maxhostlen = atoi(optarg); + break; + case 'i': + always_ip = 1; + break; + case 'N': + stripdomain = 0; + break; default: fprintf(stderr, "telnetd: %c: unknown option\n", ch); @@ -887,6 +901,7 @@ terminaltypeok(s) char *hostname; char host_name[MAXDNAME]; char remote_host_name[MAXDNAME]; +char *rhost_sane; #ifndef convex extern void telnet P((int, int)); @@ -932,6 +947,12 @@ pty_init(); } #endif /* _SC_CRAY_SECURE_SYS */ + retval = pty_make_sane_hostname(who, maxhostlen, + stripdomain, always_ip, + &rhost_sane); + if (retval) { + fatal(net, error_message(retval)); + } /* get name of connected client */ hp = gethostbyaddr((char *)&who->sin_addr, sizeof (struct in_addr), who->sin_family); @@ -939,24 +960,13 @@ pty_init(); if (hp == NULL && registerd_host_only) { fatal(net, "Couldn't resolve your address into a host name.\r\n\ Please contact your net administrator"); - } else if (hp ) { - host = hp->h_name; - } else { - host = inet_ntoa(who->sin_addr); } - /* - * We must make a copy because Kerberos is probably going - * to also do a gethost* and overwrite the static data... - */ - strncpy(remote_host_name, host, sizeof(remote_host_name)-1); - remote_host_name[sizeof(remote_host_name)-1] = 0; - host = remote_host_name; (void) gethostname(host_name, sizeof (host_name)); hostname = host_name; #if defined(AUTHENTICATION) || defined(ENCRYPTION) - auth_encrypt_init(hostname, host, "TELNETD", 1); + auth_encrypt_init(hostname, rhost_sane, "TELNETD", 1); #endif init_env(); @@ -980,7 +990,7 @@ pty_init(); * Start up the login process on the slave side of the terminal */ #ifndef convex - startslave(host, level, user_name); + startslave(rhost_sane, level, user_name); #if defined(_SC_CRAY_SECURE_SYS) if (secflag) { @@ -993,7 +1003,7 @@ pty_init(); telnet(net, pty); /* begin server processing */ #else - telnet(net, pty, host); + telnet(net, pty, rhost_sane); #endif /*NOTREACHED*/ } /* end of doit */ -- 2.26.2