A feature to allow one to telnet to a unix domain socket. (MFC from
non-crypto version) Also update the crypto telnet's man page to reflect other options ported from the non-crypto version. Obtained from: Lyndon Nerenberg <lyndon@orthanc.ab.ca>
This commit is contained in:
parent
e6b961ffbd
commit
e5c23e887b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77095
@ -39,6 +39,7 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||
|
||||
#if defined(unix)
|
||||
#include <sys/param.h>
|
||||
#include <sys/un.h>
|
||||
#if defined(CRAY) || defined(sysV88)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@ -2285,6 +2286,9 @@ sockaddr_ntop(sa)
|
||||
case AF_INET:
|
||||
addr = &((struct sockaddr_in *)sa)->sin_addr;
|
||||
break;
|
||||
case AF_UNIX:
|
||||
addr = &((struct sockaddr_un *)sa)->sun_path;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
|
||||
@ -2443,7 +2447,30 @@ tn(argc, argv)
|
||||
}
|
||||
src_res0 = src_res;
|
||||
}
|
||||
if (hostp[0] == '@' || hostp[0] == '!') {
|
||||
if (hostp[0] == '/') {
|
||||
struct sockaddr_un su;
|
||||
|
||||
if (strlen(hostp) >= sizeof(su.sun_path)) {
|
||||
fprintf(stderr, "hostname too long for unix domain socket: %s",
|
||||
hostp);
|
||||
goto fail;
|
||||
}
|
||||
memset(&su, 0, sizeof su);
|
||||
su.sun_family = AF_UNIX;
|
||||
strncpy(su.sun_path, hostp, sizeof su.sun_path);
|
||||
printf("Trying %s...\n", &su.sun_path);
|
||||
net = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if ( net < 0) {
|
||||
perror("socket");
|
||||
goto fail;
|
||||
}
|
||||
if (connect(net, (struct sockaddr *)&su, sizeof su) == -1) {
|
||||
perror(su.sun_path);
|
||||
(void) NetClose(net);
|
||||
goto fail;
|
||||
}
|
||||
goto af_unix;
|
||||
} else if (hostp[0] == '@' || hostp[0] == '!') {
|
||||
if (
|
||||
#ifdef INET6
|
||||
family == AF_INET6 ||
|
||||
@ -2626,6 +2653,7 @@ tn(argc, argv)
|
||||
if (src_res0 != NULL)
|
||||
freeaddrinfo(src_res0);
|
||||
cmdrc(hostp, hostname);
|
||||
af_unix:
|
||||
if (autologin && user == NULL) {
|
||||
struct passwd *pw;
|
||||
|
||||
|
@ -184,6 +184,9 @@ main(argc, argv)
|
||||
#undef IPSECOPT
|
||||
{
|
||||
switch(ch) {
|
||||
case 'u':
|
||||
family = AF_UNIX;
|
||||
break;
|
||||
case '4':
|
||||
family = AF_INET;
|
||||
break;
|
||||
|
@ -42,7 +42,7 @@
|
||||
protocol
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl 8EFKLNcdfry
|
||||
.Op Fl u468EFKLNcdfry
|
||||
.Op Fl S Ar tos
|
||||
.Op Fl X Ar authtype
|
||||
.Op Fl e Ar escapechar
|
||||
@ -75,6 +75,19 @@ command with those arguments.
|
||||
.Pp
|
||||
Options:
|
||||
.Bl -tag -width indent
|
||||
.It Fl u
|
||||
Forces
|
||||
.Nm
|
||||
to use
|
||||
AF_UNIX addresses only (e.g. unix domain sockets, accessed with a file path)
|
||||
.It Fl 4
|
||||
Forces
|
||||
.Nm
|
||||
to use IPv4 addresses only.
|
||||
.It Fl 6
|
||||
Forces
|
||||
.Nm
|
||||
to use IPv6 addresses only.
|
||||
.It Fl 8
|
||||
Specifies an 8-bit data path. This causes an attempt to
|
||||
negotiate the
|
||||
@ -191,7 +204,11 @@ This is now the default, so this option is ignored.
|
||||
Suppresses encryption of the data stream.
|
||||
.It Ar host
|
||||
Indicates the official name, an alias, or the Internet address
|
||||
of a remote host.
|
||||
of a remote host. If
|
||||
.Ar host
|
||||
starts with a /,
|
||||
.Nm
|
||||
establishes a connection to the corresponding named socket.
|
||||
.It Ar port
|
||||
Indicates a port number (address of an application). If a number is
|
||||
not specified, the default
|
||||
|
@ -39,6 +39,7 @@ static const char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95";
|
||||
|
||||
#if defined(unix)
|
||||
#include <sys/param.h>
|
||||
#include <sys/un.h>
|
||||
#if defined(CRAY) || defined(sysV88)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@ -2285,6 +2286,9 @@ sockaddr_ntop(sa)
|
||||
case AF_INET:
|
||||
addr = &((struct sockaddr_in *)sa)->sin_addr;
|
||||
break;
|
||||
case AF_UNIX:
|
||||
addr = &((struct sockaddr_un *)sa)->sun_path;
|
||||
break;
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
addr = &((struct sockaddr_in6 *)sa)->sin6_addr;
|
||||
@ -2443,7 +2447,30 @@ tn(argc, argv)
|
||||
}
|
||||
src_res0 = src_res;
|
||||
}
|
||||
if (hostp[0] == '@' || hostp[0] == '!') {
|
||||
if (hostp[0] == '/') {
|
||||
struct sockaddr_un su;
|
||||
|
||||
if (strlen(hostp) >= sizeof(su.sun_path)) {
|
||||
fprintf(stderr, "hostname too long for unix domain socket: %s",
|
||||
hostp);
|
||||
goto fail;
|
||||
}
|
||||
memset(&su, 0, sizeof su);
|
||||
su.sun_family = AF_UNIX;
|
||||
strncpy(su.sun_path, hostp, sizeof su.sun_path);
|
||||
printf("Trying %s...\n", &su.sun_path);
|
||||
net = socket(PF_UNIX, SOCK_STREAM, 0);
|
||||
if ( net < 0) {
|
||||
perror("socket");
|
||||
goto fail;
|
||||
}
|
||||
if (connect(net, (struct sockaddr *)&su, sizeof su) == -1) {
|
||||
perror(su.sun_path);
|
||||
(void) NetClose(net);
|
||||
goto fail;
|
||||
}
|
||||
goto af_unix;
|
||||
} else if (hostp[0] == '@' || hostp[0] == '!') {
|
||||
if (
|
||||
#ifdef INET6
|
||||
family == AF_INET6 ||
|
||||
@ -2626,6 +2653,7 @@ tn(argc, argv)
|
||||
if (src_res0 != NULL)
|
||||
freeaddrinfo(src_res0);
|
||||
cmdrc(hostp, hostname);
|
||||
af_unix:
|
||||
if (autologin && user == NULL) {
|
||||
struct passwd *pw;
|
||||
|
||||
|
@ -184,6 +184,9 @@ main(argc, argv)
|
||||
#undef IPSECOPT
|
||||
{
|
||||
switch(ch) {
|
||||
case 'u':
|
||||
family = AF_UNIX;
|
||||
break;
|
||||
case '4':
|
||||
family = AF_INET;
|
||||
break;
|
||||
|
@ -42,7 +42,7 @@
|
||||
protocol
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl 8EFKLNcdfry
|
||||
.Op Fl u468EFKLNcdfry
|
||||
.Op Fl S Ar tos
|
||||
.Op Fl X Ar authtype
|
||||
.Op Fl e Ar escapechar
|
||||
@ -75,6 +75,19 @@ command with those arguments.
|
||||
.Pp
|
||||
Options:
|
||||
.Bl -tag -width indent
|
||||
.It Fl u
|
||||
Forces
|
||||
.Nm
|
||||
to use
|
||||
AF_UNIX addresses only (e.g. unix domain sockets, accessed with a file path)
|
||||
.It Fl 4
|
||||
Forces
|
||||
.Nm
|
||||
to use IPv4 addresses only.
|
||||
.It Fl 6
|
||||
Forces
|
||||
.Nm
|
||||
to use IPv6 addresses only.
|
||||
.It Fl 8
|
||||
Specifies an 8-bit data path. This causes an attempt to
|
||||
negotiate the
|
||||
@ -191,7 +204,11 @@ This is now the default, so this option is ignored.
|
||||
Suppresses encryption of the data stream.
|
||||
.It Ar host
|
||||
Indicates the official name, an alias, or the Internet address
|
||||
of a remote host.
|
||||
of a remote host. If
|
||||
.Ar host
|
||||
starts with a /,
|
||||
.Nm
|
||||
establishes a connection to the corresponding named socket.
|
||||
.It Ar port
|
||||
Indicates a port number (address of an application). If a number is
|
||||
not specified, the default
|
||||
|
Loading…
Reference in New Issue
Block a user