diff --git a/SOURCES/netkit-telnet-0.17-manpage.patch b/SOURCES/netkit-telnet-0.17-manpage.patch new file mode 100644 index 0000000..58dc7cb --- /dev/null +++ b/SOURCES/netkit-telnet-0.17-manpage.patch @@ -0,0 +1,15 @@ +diff --git a/telnet/telnet.1 b/telnet/telnet.1 +index f30e034..595056c 100644 +--- a/telnet/telnet.1 ++++ b/telnet/telnet.1 +@@ -74,6 +74,10 @@ If it is invoked with arguments, it performs an + .Ic open + command with those arguments. + .Pp ++If a hostname is resolved to multiple IP addresses, ++.Nm ++attempts to establish a connection with each address until one of them is successful or until no more addresses are left. ++.Pp + The options are as follows: + .Bl -tag -width Ds + .It Fl 4 diff --git a/SOURCES/telnet-0.17-force-ipv6-ipv4.patch b/SOURCES/telnet-0.17-force-ipv6-ipv4.patch new file mode 100644 index 0000000..cbdd63b --- /dev/null +++ b/SOURCES/telnet-0.17-force-ipv6-ipv4.patch @@ -0,0 +1,141 @@ +diff --git a/commands.c b/commands.c +index 49619ac..636fb5c 100644 +--- a/telnet/commands.c ++++ b/telnet/commands.c +@@ -2267,6 +2267,7 @@ tn(int argc, char *argv[]) + char *srp = 0; + int srlen; + #endif ++ int family = AF_UNSPEC; + char *cmd, *hostp = 0, *portp = 0, *user = 0, *aliasp = 0; + int retry; + #ifdef NI_WITHSCOPEID +@@ -2317,6 +2318,21 @@ tn(int argc, char *argv[]) + autologin = 1; + continue; + } ++ ++ if (strcmp(*argv, "-6") == 0) { ++ --argc; ++argv; ++#ifdef AF_INET6 ++ family = AF_INET6; ++#else ++ puts("IPv6 unsupported"); ++#endif ++ continue; ++ } ++ if (strcmp(*argv, "-4") == 0) { ++ --argc; ++argv; ++ family = AF_INET; ++ continue; ++ } + if (hostp == 0) { + hostp = *argv++; + --argc; +@@ -2355,7 +2371,7 @@ tn(int argc, char *argv[]) + { + hostname = hostp; + memset(&hints, 0, sizeof(hints)); +- hints.ai_family = PF_UNSPEC; ++ hints.ai_family = family; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + if (portp == NULL) { +diff --git a/main.c b/main.c +index 5fa96e8..599f0af 100644 +--- a/telnet/main.c ++++ b/telnet/main.c +@@ -80,10 +80,10 @@ usage(void) + fprintf(stderr, "Usage: %s %s%s%s%s\n", + prompt, + #ifdef AUTHENTICATION +- "[-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]", ++ "[-4] [-6] [-8] [-E] [-K] [-L] [-S tos] [-X atype] [-a] [-c] [-d] [-e char]", + "\n\t[-k realm] [-l user] [-f/-F] [-n tracefile] [-b hostalias ] ", + #else +- "[-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]", ++ "[-4] [-6] [-8] [-E] [-L] [-S tos] [-a] [-c] [-d] [-e char] [-l user]", + "\n\t[-n tracefile] [-b hostalias ] ", + #endif + #if defined(TN3270) && defined(unix) +@@ -116,6 +116,7 @@ main(int argc, char *argv[]) + #endif + int ch; + char *user, *alias; ++ int family; + #ifdef FORWARD + extern int forward_flags; + #endif /* FORWARD */ +@@ -130,7 +131,6 @@ main(int argc, char *argv[]) + prompt = argv[0]; + + user = alias = NULL; +- + rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE; + + /* +@@ -139,9 +139,19 @@ main(int argc, char *argv[]) + * passed + */ + autologin = -1; +- +- while ((ch = getopt(argc, argv, "78DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) { ++ family = 0; ++ while ((ch = getopt(argc, argv, "4678DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) { + switch(ch) { ++ case '4': ++ family = AF_INET; ++ break; ++ case '6': ++#ifdef AF_INET6 ++ family = AF_INET6; ++#else ++ fputs("IPv6 unsupported\n", stderr); ++#endif ++ break; + case '8': + binary = 3; /* send TELNET BINARY option for output and input */ + break; +@@ -337,7 +337,7 @@ main(int argc, char *argv[]) + argv += optind; + + if (argc) { +- char *args[7], **argp = args; ++ char *args[8], **argp = args; + + if (argc > 2) + usage(); +@@ -340,6 +350,9 @@ main(int argc, char *argv[]) + *argp++ = "-b"; + *argp++ = alias; + } ++ if (family) { ++ *argp++ = family == AF_INET ? "-4" : "-6"; ++ } + *argp++ = argv[0]; /* host */ + if (argc > 1) + *argp++ = argv[1]; /* port */ +diff --git a/telnet.1 b/telnet.1 +index 50015a6..f30e034 100644 +--- a/telnet/telnet.1 ++++ b/telnet/telnet.1 +@@ -44,7 +44,7 @@ + protocol + .Sh SYNOPSIS + .Nm telnet +-.Op Fl 8EFKLacdfrx ++.Op Fl 468EFKLacdfrx + .Op Fl X Ar authtype + .Op Fl b Ar hostalias + .Op Fl e Ar escapechar +@@ -76,6 +76,10 @@ command with those arguments. + .Pp + The options are as follows: + .Bl -tag -width Ds ++.It Fl 4 ++Force IPv4 address resolution. ++.It Fl 6 ++Force IPv6 address resolution. + .It Fl 7 + Strip 8th bit on input and output. Telnet is 8-bit clean by default but doesn't send the TELNET BINARY option unless forced. + .It Fl 8 diff --git a/SPECS/telnet.spec b/SPECS/telnet.spec index 7fce6e2..faeab18 100644 --- a/SPECS/telnet.spec +++ b/SPECS/telnet.spec @@ -3,7 +3,7 @@ Summary: The client program for the Telnet remote login protocol Name: telnet Version: 0.17 -Release: 60%{?dist} +Release: 64%{?dist} Epoch: 1 License: BSD Group: Applications/Internet @@ -36,6 +36,8 @@ Patch24: telnet-rh674942.patch Patch25: telnet-rh704604.patch Patch26: telnet-rh825946.patch Patch27: telnet-log-address.patch +Patch28: telnet-0.17-force-ipv6-ipv4.patch +Patch29: netkit-telnet-0.17-manpage.patch BuildRequires: ncurses-devel systemd @@ -86,6 +88,8 @@ mv telnet telnet-NETKIT %patch25 -p1 -b .rh704604 %patch26 -p1 -b .rh825946 %patch27 -p1 -b .rh1323094 +%patch28 -p1 -b .ipv6-support +%patch29 -p1 -b .manpage %build %ifarch s390 s390x @@ -151,6 +155,20 @@ install -p -m644 %SOURCE6 ${RPM_BUILD_ROOT}%{_unitdir}/telnet.socket %{_mandir}/man8/telnetd.8* %changelog +* Wed Apr 19 2017 Michal Ruprich - 1:0.17-64 +- Related: #1367415 - No option to specify IPv6 or IPv4 explicitly must be used + - more clear formulation of man page note - previous note was a bit ambiguous + +* Wed Apr 19 2017 Michal Ruprich - 1:0.17-63 +- Related: #1367415 - No option to specify IPv6 or IPv4 explicitly must be used + - additional info added to manpage + +* Mon Jan 23 2017 Michal Ruprich - 1:0.17-62 +- Related: #1367415 - No option to specify IPv6 or IPv4 explicitly must be used + +* Wed Jan 18 2017 Michal Ruprich - 1:0.17-61 +- Resolves: #1367415 - No option to specify IPv6 or IPv4 explicitly must be used + * Fri Jul 01 2016 Martin Sehnoutka - 1:0.17-60 - Introduce new -i switch - ip addresses will be logged into utmp instead of hostname