From 1ba886f1b1ce852f34075a4800f6643c8a60ffc2 Mon Sep 17 00:00:00 2001 From: Luboš Uhliarik Date: Sep 30 2015 13:26:00 +0000 Subject: Resolves: #1069809 - No option to specify IPv6 or IPv4 explicitly must be used --- diff --git a/telnet-0.17-ipv6-support.patch b/telnet-0.17-ipv6-support.patch new file mode 100644 index 0000000..2966fd9 --- /dev/null +++ b/telnet-0.17-ipv6-support.patch @@ -0,0 +1,118 @@ +diff --git a/telnet/commands.c b/telnet/commands.c +index 49619ac..bc43d54 100644 +--- a/telnet/commands.c ++++ b/telnet/commands.c +@@ -2365,6 +2365,10 @@ tn(int argc, char *argv[]) + portp++; + telnetport = 1; + } ++ ++ if (family) ++ hints.ai_family = family; ++ + h_errno = 0; + error = getaddrinfo(hostp, portp, &hints, &res0); + if (error) { +@@ -2400,6 +2404,9 @@ tn(int argc, char *argv[]) + ahints.ai_family = PF_UNSPEC; + ahints.ai_socktype = SOCK_STREAM; + ahints.ai_flags = AI_PASSIVE; ++ if (family) ++ ahints.ai_family = family; ++ + error = getaddrinfo(aliasp, "0", &ahints, &ares); + if (error) { + printf ("Couldn't get address for %s\n", aliasp); +diff --git a/telnet/externs.h b/telnet/externs.h +index a42d0dc..93ed218 100644 +--- a/telnet/externs.h ++++ b/telnet/externs.h +@@ -57,6 +57,7 @@ extern int + autologin, /* Autologin enabled */ + skiprc, /* Don't process the ~/.telnetrc file */ + eight, /* use eight bit mode (binary in and/or out */ ++ family, /* forced ip family */ + binary, + flushout, /* flush output */ + connected, /* Are we connected to the other side? */ +diff --git a/telnet/main.c b/telnet/main.c +index 5fa96e8..2b0227c 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) +@@ -140,7 +140,7 @@ main(int argc, char *argv[]) + */ + autologin = -1; + +- while ((ch = getopt(argc, argv, "78DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) { ++ while ((ch = getopt(argc, argv, "4678DEKLS:X:ab:cde:fFk:l:n:rt:x")) != -1) { + switch(ch) { + case '8': + binary = 3; /* send TELNET BINARY option for output and input */ +@@ -148,6 +148,18 @@ main(int argc, char *argv[]) + case '7': + eight = 0; + break; ++ case '6': ++#ifdef AF_INET6 ++ family = AF_INET6; ++#else ++ fprintf(stderr, ++ "%s: Warning: -6 ignored, no IPv6 support.\n", ++ prompt); ++#endif ++ break; ++ case '4': ++ family = AF_INET; ++ break; + case 'D': { + /* sometimes we don't want a mangled display */ + char *p; +diff --git a/telnet/telnet.1 b/telnet/telnet.1 +index 50015a6..c7af14a 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/telnet/telnet.c b/telnet/telnet.c +index a3b5a08..52ab06f 100644 +--- a/telnet/telnet.c ++++ b/telnet/telnet.c +@@ -62,6 +62,7 @@ int + binary = 0, + autologin = 0, /* Autologin anyone? */ + skiprc = 0, ++ family = 0, + connected, + showoptions, + In3270, /* Are we in 3270 mode? */ diff --git a/telnet.spec b/telnet.spec index 5a5c7c8..896bcb6 100644 --- a/telnet.spec +++ b/telnet.spec @@ -3,7 +3,7 @@ Summary: The client program for the Telnet remote login protocol Name: telnet Version: 0.17 -Release: 61%{?dist} +Release: 62%{?dist} Epoch: 1 License: BSD Group: Applications/Internet @@ -35,6 +35,7 @@ Patch23: telnet-rh678324.patch Patch24: telnet-rh674942.patch Patch25: telnet-rh704604.patch Patch26: telnet-rh825946.patch +Patch27: telnet-0.17-ipv6-support.patch BuildRequires: ncurses-devel systemd @@ -84,6 +85,7 @@ mv telnet telnet-NETKIT %patch24 -p1 -b .rh674942 %patch25 -p1 -b .rh704604 %patch26 -p1 -b .rh825946 +%patch27 -p1 -b .ipv6-support %build %ifarch s390 s390x @@ -149,6 +151,9 @@ install -p -m644 %SOURCE6 ${RPM_BUILD_ROOT}%{_unitdir}/telnet.socket %{_mandir}/man8/telnetd.8* %changelog +* Wed Sep 30 2015 Luboš Uhliarik - 1:0.17-62 +- Resolves: #1069809 - No option to specify IPv6 or IPv4 explicitly must be used + * Fri Jun 19 2015 Fedora Release Engineering - 1:0.17-61 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild