diff --git a/telnet-0.17-force-ipv6-ipv4.patch b/telnet-0.17-force-ipv6-ipv4.patch new file mode 100644 index 0000000..e374c9c --- /dev/null +++ b/telnet-0.17-force-ipv6-ipv4.patch @@ -0,0 +1,132 @@ +diff --git a/commands.c b/commands.c +index 49619ac..636fb5c 100644 +--- a/commands.c ++++ b/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/main.c ++++ b/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; +@@ -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.1 ++++ b/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-0.17-ipv6-support.patch b/telnet-0.17-ipv6-support.patch deleted file mode 100644 index 2966fd9..0000000 --- a/telnet-0.17-ipv6-support.patch +++ /dev/null @@ -1,118 +0,0 @@ -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 896bcb6..6828161 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: 62%{?dist} +Release: 63%{?dist} Epoch: 1 License: BSD Group: Applications/Internet @@ -35,7 +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 +Patch27: telnet-0.17-force-ipv6-ipv4.patch BuildRequires: ncurses-devel systemd @@ -151,6 +151,9 @@ install -p -m644 %SOURCE6 ${RPM_BUILD_ROOT}%{_unitdir}/telnet.socket %{_mandir}/man8/telnetd.8* %changelog +* Thu Oct 29 2015 Luboš Uhliarik - 1:0.17-63 +- Related: #1069809 - changed patch name + some minor changes in patch + * Wed Sep 30 2015 Luboš Uhliarik - 1:0.17-62 - Resolves: #1069809 - No option to specify IPv6 or IPv4 explicitly must be used