Clean up telnet's argument processing a bit. autologin and encryption is

now the default, so ignore the arguments that turn it on. Add a new -y
argument to turn off encryption in case someone wants to do that. Sync
these changes with the man page (including removing the now obsolete
statement about availability only in the US and Canada).


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@75263 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
nsayer 2001-04-06 15:56:10 +00:00
parent 785ba71778
commit eca1a06f99
2 changed files with 23 additions and 34 deletions

View File

@ -105,10 +105,10 @@ usage()
fprintf(stderr, "Usage: %s %s%s%s%s\n",
prompt,
#ifdef AUTHENTICATION
"[-4] [-6] [-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-a] [-c] [-d]",
"[-4] [-6] [-8] [-E] [-K] [-L] [-N] [-S tos] [-X atype] [-c] [-d]",
"\n\t[-e char] [-k realm] [-l user] [-f/-F] [-n tracefile] ",
#else
"[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-a] [-c] [-d] [-e char] [-l user]",
"[-4] [-6] [-8] [-E] [-L] [-N] [-S tos] [-c] [-d] [-e char] [-l user]",
"\n\t[-n tracefile] ",
#endif
#if defined(TN3270) && defined(unix)
@ -126,7 +126,7 @@ usage()
"[-P policy]"
#endif
#ifdef ENCRYPTION
"[-x] [host-name [port]]"
"[-y] [host-name [port]]"
#else /* ENCRYPTION */
"[host-name [port]]"
#endif /* ENCRYPTION */
@ -167,7 +167,12 @@ main(argc, argv)
user = NULL;
rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE;
autologin = -1;
autologin = 1;
#if defined(ENCRYPTION)
encrypt_auto(1);
decrypt_auto(1);
#endif
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
#define IPSECOPT "P:"
@ -175,7 +180,7 @@ main(argc, argv)
#define IPSECOPT
#endif
while ((ch = getopt(argc, argv,
"468EKLNS:X:acde:fFk:l:n:rs:t:x" IPSECOPT)) != -1)
"468EKLNS:X:acde:fFk:l:n:rs:t:xy" IPSECOPT)) != -1)
#undef IPSECOPT
{
switch(ch) {
@ -227,7 +232,7 @@ main(argc, argv)
#endif
break;
case 'a':
autologin = 1;
/* It's the default now, so ignore */
break;
case 'c':
skiprc = 1;
@ -283,9 +288,6 @@ main(argc, argv)
#endif
break;
case 'l':
autologin = 1;
if(autologin == 0)
autologin = -1;
user = optarg;
break;
case 'n':
@ -321,13 +323,12 @@ main(argc, argv)
#endif
break;
case 'x':
/* This is the default now, so ignore it */
break;
case 'y':
#ifdef ENCRYPTION
encrypt_auto(1);
decrypt_auto(1);
#else /* ENCRYPTION */
fprintf(stderr,
"%s: Warning: -x ignored, no ENCRYPT support.\n",
prompt);
encrypt_auto(0);
decrypt_auto(0);
#endif /* ENCRYPTION */
break;
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
@ -347,19 +348,6 @@ main(argc, argv)
}
}
if (autologin == -1) { /* esc@magic.fi; force */
#if defined(AUTHENTICATION)
autologin = 1;
#endif
#if defined(ENCRYPTION)
encrypt_auto(1);
decrypt_auto(1);
#endif
}
if (autologin == -1)
autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1;
argc -= optind;
argv += optind;

View File

@ -42,7 +42,7 @@
protocol
.Sh SYNOPSIS
.Nm
.Op Fl 8EFKLNacdfrx
.Op Fl 8EFKLNcdfry
.Op Fl S Ar tos
.Op Fl X Ar authtype
.Op Fl e Ar escapechar
@ -108,8 +108,8 @@ Disables the
.Ar atype
type of authentication.
.It Fl a
Attempt automatic login.
Currently, this sends the user name via the
Attempt automatic login. This is now the default, so this option is
ignored. Currently, this sends the user name via the
.Ev USER
variable
of the
@ -184,9 +184,10 @@ connection to
.Ar src_addr ,
which can be an IP address or a host name.
.It Fl x
Turns on encryption of the data stream if possible. This
option is not available outside of the United States and
Canada.
Turns on encryption of the data stream if possible. This is now the
default, so this option is ignored.
.It Fl y
Suppresses encryption of the data stream.
.It Ar host
Indicates the official name, an alias, or the Internet address
of a remote host.