aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>1999-02-22 23:30:55 +0000
committerTom Yu <tlyu@mit.edu>1999-02-22 23:30:55 +0000
commit683eb9ae7217196b59967b011ebf95cf8f1a2c3f (patch)
tree0ff167b10f43ef7c2c06abb9ec6b3ab655321eb1
parentf507232b1f330bd9c8237c862b1aa0ecb720e1cb (diff)
downloadkrb5-683eb9ae7217196b59967b011ebf95cf8f1a2c3f.zip
krb5-683eb9ae7217196b59967b011ebf95cf8f1a2c3f.tar.gz
krb5-683eb9ae7217196b59967b011ebf95cf8f1a2c3f.tar.bz2
* telnetd.8: Document hostname logging changes
* telnetd.c: Add options to control logging of remote hostname to login(1). [pullup from trunk] git-svn-id: svn://anonsvn.mit.edu/krb5/branches/V1_0_BRANCH@11209 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/appl/telnet/telnetd/ChangeLog7
-rw-r--r--src/appl/telnet/telnetd/telnetd.813
-rw-r--r--src/appl/telnet/telnetd/telnetd.c38
3 files changed, 43 insertions, 15 deletions
diff --git a/src/appl/telnet/telnetd/ChangeLog b/src/appl/telnet/telnetd/ChangeLog
index 766c745..a712a45 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 <tlyu@mit.edu>
+
+ * 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 <tytso@mit.edu>
* 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 f7daded..93c64ac 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 32a6bf8..6077c2e 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
@@ -416,6 +421,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);
@@ -865,6 +879,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));
@@ -910,6 +925,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);
@@ -917,24 +938,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();
@@ -958,7 +968,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) {
@@ -971,7 +981,7 @@ pty_init();
telnet(net, pty); /* begin server processing */
#else
- telnet(net, pty, host);
+ telnet(net, pty, rhost_sane);
#endif
/*NOTREACHED*/
} /* end of doit */