summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/0001-ftp-include-sys-types.h-for-u_long.patch32
-rw-r--r--meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/Add_ARG_MAX_define.patch27
-rw-r--r--meta-networking/recipes-netkit/netkit-ftp/netkit-ftp_0.17.bb50
-rw-r--r--meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/0001-rpcgen-Fix-printf-formats.patch53
-rw-r--r--meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/gcc4.patch39
-rw-r--r--meta-networking/recipes-netkit/netkit-rpc/netkit-rpc_0.17.bb51
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/CVE-2019-7282-and-CVE-2019-7283.patch35
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fix-host-variable.patch27
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fixup_wait3_api_change.patch34
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/netkit-rsh-0.17-rexec-ipv6.patch30
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/no_pam_build_fix.patch39
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.pam10
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.xinetd.netkit20
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.pam12
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.xinetd.netkit23
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh-redone_link_order_file.patch77
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.pam10
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.xinetd.netkit21
-rw-r--r--meta-networking/recipes-netkit/netkit-rsh/netkit-rsh_0.17.bb105
-rw-r--r--meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/0001-Link-with-libtirpc.patch120
-rw-r--r--meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/rpc.rusersd-Makefile-fix-parallel-build-issue.patch30
-rw-r--r--meta-networking/recipes-netkit/netkit-rusers/netkit-rusers_0.17.bb72
-rw-r--r--meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0001-Add-missing-include-path-to-I-options.patch46
-rw-r--r--meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0002-Fix-build-issues-found-with-musl.patch72
-rwxr-xr-xmeta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod71
-rw-r--r--meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod.default2
-rw-r--r--meta-networking/recipes-netkit/netkit-rwho/netkit-rwho_0.17.bb108
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/0001-Drop-using-register-keyword.patch457
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-deadlock-on-cleanup.patch116
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-print-format-strings.patch68
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/0001-telnetd-utility.c-Fix-buffer-overflow-in-netoprintf.patch56
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/0001-utility-Include-time.h-form-time-and-strftime-protot.patch27
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/CVE-2020-10188.patch112
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/CVE-2022-39028.patch53
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/To-aviod-buffer-overflow-in-telnet.patch1217
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/Warning-fix-in-the-step-of-install.patch41
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/cross-compile.patch48
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/files/telnet-xinetd14
-rw-r--r--meta-networking/recipes-netkit/netkit-telnet/netkit-telnet_0.17.bb74
-rw-r--r--meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/0001-tftp-Include-missing-fcntl.h.patch27
-rw-r--r--meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/tftp.conf11
-rw-r--r--meta-networking/recipes-netkit/netkit-tftp/netkit-tftp_0.17.bb59
42 files changed, 0 insertions, 3596 deletions
diff --git a/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/0001-ftp-include-sys-types.h-for-u_long.patch b/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/0001-ftp-include-sys-types.h-for-u_long.patch
deleted file mode 100644
index 2cd639ee92..0000000000
--- a/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/0001-ftp-include-sys-types.h-for-u_long.patch
+++ /dev/null
@@ -1,32 +0,0 @@
1From 2ee0c51d81a0a08d64b64ab624074e5f7cd9615a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 15 Jul 2017 00:07:32 -0700
4Subject: [PATCH] ftp: include sys/types.h for u_long
5
6fixes
7ftp.c:1091:2: error: unknown type name 'u_long'; did you mean 'long'?
8 u_long a1,a2,a3,a4,p1,p2;
9 ^~~~~~
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13Upstream-Status: Pending
14
15 ftp/ftp.c | 1 +
16 1 file changed, 1 insertion(+)
17
18diff --git a/ftp/ftp.c b/ftp/ftp.c
19index 7a56af6..5dcb513 100644
20--- a/ftp/ftp.c
21+++ b/ftp/ftp.c
22@@ -43,6 +43,7 @@ char ftp_rcsid[] =
23 #include <sys/socket.h>
24 #include <sys/time.h>
25 #include <sys/file.h>
26+#include <sys/types.h>
27
28 #include <netinet/in.h>
29 #include <netinet/ip.h>
30--
312.13.3
32
diff --git a/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/Add_ARG_MAX_define.patch b/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/Add_ARG_MAX_define.patch
deleted file mode 100644
index 5db004865f..0000000000
--- a/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp/Add_ARG_MAX_define.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1This adds ARG_MAX define to be _SC_ARG_MAX
2
3Upstream-Status: Inappropriate [Most distros have their own verion for this fix]
4
5Signed-off-by: Armin Kuster <akuster808@gmail.com>
6
7Index: netkit-ftp-0.17/ftp/glob.c
8===================================================================
9--- netkit-ftp-0.17.orig/ftp/glob.c
10+++ netkit-ftp-0.17/ftp/glob.c
11@@ -50,6 +50,7 @@ char glob_rcsid[] =
12 #include <stdio.h>
13 #include <stdlib.h>
14 #include <string.h>
15+#include <unistd.h>
16
17 #include "ftp_var.h" /* for protos only */
18 #include "glob.h"
19@@ -57,6 +58,9 @@ char glob_rcsid[] =
20 #define QUOTE 0200
21 #define TRIM 0177
22 #define eq(a,b) (strcmp(a, b)==0)
23+#ifndef ARG_MAX
24+#define ARG_MAX (sysconf(_SC_ARG_MAX))
25+#endif
26 #define GAVSIZ (ARG_MAX/6)
27 #define isdir(d) ((d.st_mode & S_IFMT) == S_IFDIR)
diff --git a/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp_0.17.bb b/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp_0.17.bb
deleted file mode 100644
index 31fdd9e4d8..0000000000
--- a/meta-networking/recipes-netkit/netkit-ftp/netkit-ftp_0.17.bb
+++ /dev/null
@@ -1,50 +0,0 @@
1DESCRIPTION = "netkit-ft includes the ftp client."
2SECTION = "net"
3HOMEPAGE="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit"
4LICENSE = "BSD-4-Clause"
5
6LIC_FILES_CHKSUM = "file://ftp/ftp.c;beginline=2;endline=3;md5=2d40a75a50d83b8f6317b3f53db72bfa"
7
8SRC_URI = "${DEBIAN_MIRROR}/main/n/netkit-ftp/netkit-ftp_${PV}.orig.tar.gz;name=archive \
9 ${DEBIAN_MIRROR}/main/n/netkit-ftp/netkit-ftp_${PV}-34.debian.tar.xz;name=patch34 \
10 file://Add_ARG_MAX_define.patch \
11 file://0001-ftp-include-sys-types.h-for-u_long.patch \
12 "
13SRC_URI[archive.sha256sum] = "61c913299b81a4671ff089aac821329f7db9bc111aa812993dd585798b700349"
14SRC_URI[patch34.sha256sum] = "716b984bc6926ed98345fa4e68adcee2efcf08d0f7315d6be8ad6de76f255748"
15
16inherit autotools-brokensep update-alternatives
17
18CLEANBROKEN = "1"
19
20do_configure () {
21 ./configure --prefix=${prefix}
22 echo "LDFLAGS=${LDFLAGS}" >> MCONFIG
23}
24
25BINMODE = "0755"
26MANMODE = "0644"
27
28do_install () {
29 install -d ${D}${bindir}
30 install -d ${D}${mandir}/man1
31 install -d ${D}${mandir}/man5
32
33 install -m${BINMODE} ${S}/ftp/ftp ${D}${bindir}
34 ln -sf ftp ${D}${bindir}/pftp
35 install -m${MANMODE} ${S}/ftp/ftp.1 ${D}${mandir}/man1
36 ln -sf ftp.1 ${D}${mandir}/man1/pftp.1
37 install -m${MANMODE} ${S}/ftp/netrc.5 ${D}${mandir}/man5
38}
39
40PACKAGES = "${PN} ${PN}-doc ${BPN}-dbg"
41FILES:${PN} = "${bindir}/*"
42FILES:${PN}-doc = "${mandir}"
43FILES:${PN}-dbg = "${prefix}/src/debug \
44 ${bindir}/.debug"
45
46RDEPENDS:${PN} = "readline"
47
48ALTERNATIVE_PRIORITY = "100"
49ALTERNATIVE:${PN} = "ftp"
50ALTERNATIVE_LINK_NAME[ftp] = "${bindir}/ftp"
diff --git a/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/0001-rpcgen-Fix-printf-formats.patch b/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/0001-rpcgen-Fix-printf-formats.patch
deleted file mode 100644
index 508db6aadf..0000000000
--- a/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/0001-rpcgen-Fix-printf-formats.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 439e3e35f7fcbff1abb782de4b19b31e43ae3449 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 09:59:19 -0700
4Subject: [PATCH] rpcgen: Fix printf formats
5
6Fixes build with hardening flags
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11
12 rpcgen/rpc_hout.c | 2 +-
13 rpcgen/rpc_tblout.c | 4 ++--
14 2 files changed, 3 insertions(+), 3 deletions(-)
15
16diff --git a/rpcgen/rpc_hout.c b/rpcgen/rpc_hout.c
17index 0ef52df..09a7b57 100644
18--- a/rpcgen/rpc_hout.c
19+++ b/rpcgen/rpc_hout.c
20@@ -474,7 +474,7 @@ pdeclaration(const char *name, declaration *dec, int tab,
21 break;
22 }
23 }
24- f_print(fout, separator );
25+ f_print(fout, "%s", separator );
26 }
27
28 static int
29diff --git a/rpcgen/rpc_tblout.c b/rpcgen/rpc_tblout.c
30index d64bfde..fd62a52 100644
31--- a/rpcgen/rpc_tblout.c
32+++ b/rpcgen/rpc_tblout.c
33@@ -99,7 +99,7 @@ write_table(const definition *def)
34 }
35 else {
36 expected = 1;
37- f_print(fout, null_entry);
38+ f_print(fout, "%s", null_entry);
39 }
40 for (proc = vp->procs; proc != NULL; proc = proc->next) {
41 current = atoi(proc->proc_num);
42@@ -139,7 +139,7 @@ write_table(const definition *def)
43 }
44
45 /* print the table trailer */
46- f_print(fout, tbl_end);
47+ f_print(fout, "%s", tbl_end);
48 f_print(fout, tbl_nproc, progvers, progvers, progvers);
49 }
50 }
51--
522.13.2
53
diff --git a/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/gcc4.patch b/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/gcc4.patch
deleted file mode 100644
index 83bcc4b490..0000000000
--- a/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc/gcc4.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1This fixes an issue when building with gcc 4.x
2
3https://github.com/openembedded/openembedded/tree/master/recipes/netkit-rpc/netkit-rpc
4
5Upstream-Status: Backport
6
7Signed-off-by: Armin Kuster <akuster808@gmail.com>
8
9--- netkit-rpc-0.17/rpcgen/rpc_cout.c~gcc4
10+++ netkit-rpc-0.17/rpcgen/rpc_cout.c
11@@ -101,8 +101,6 @@
12 case DEF_TYPEDEF:
13 emit_typedef(def);
14 break;
15- default:
16- /* can't happen */
17 }
18 print_trailer();
19 }
20@@ -664,9 +662,6 @@
21 decl->name,decl->array_max);
22 emit_single_in_line(decl,flag,REL_VECTOR);
23 f_print(fout,"\t\t }\n\t\t };\n");
24-
25- default:
26- /* ?... do nothing I guess */
27 }
28 }
29
30--- netkit-rpc-0.17/rpcgen/rpc_hout.c~gcc4
31+++ netkit-rpc-0.17/rpcgen/rpc_hout.c
32@@ -106,8 +106,6 @@
33 f_print(fout, "\n");
34 pprogramdef(def);
35 break;
36- default:
37- /* ?... shouldn't happen I guess */
38 }
39 }
diff --git a/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc_0.17.bb b/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc_0.17.bb
deleted file mode 100644
index cb05645ee8..0000000000
--- a/meta-networking/recipes-netkit/netkit-rpc/netkit-rpc_0.17.bb
+++ /dev/null
@@ -1,51 +0,0 @@
1DESCRIPTION = "netkit-rpc includes rpcinfo and rpcgen."
2HOMEPAGE = "http://ftp.linux.org.uk/pub/linux/Networking/netkit"
3SECTION = "net"
4LICENSE = "SPL-1.0"
5LIC_FILES_CHKSUM = "file://rpcinfo/rpcinfo.c;beginline=2;endline=3;md5=3e6339e3ce266e1122c5ba293e04bc89"
6
7DEPENDS += "libtirpc"
8SRC_URI = "http://sources.openembedded.org/${BPN}-${PV}.tar.gz \
9 file://gcc4.patch \
10 file://0001-rpcgen-Fix-printf-formats.patch \
11 "
12SRC_URI[md5sum] = "67212720482ea1aea9182a98653a9642"
13SRC_URI[sha256sum] = "421d63b414162237a72867061f1bd3e3752a0d962cd5d30b5e933ddad8a14d3b"
14
15inherit update-alternatives
16
17CFLAGS += "-I${STAGING_INCDIR}/tirpc"
18LIBS += "-ltirpc"
19
20do_configure () {
21 ./configure --prefix=${prefix}
22 echo "LDFLAGS=${LDFLAGS}" > MCONFIG
23 echo "CC=${CC}" >> MCONFIG
24 echo "LD=${LD}" >> MCONFIG
25 echo "CFLAGS=${CFLAGS}" >> MCONFIG
26 echo "LDFLAGS=${LDFLAGS}" >> MCONFIG
27 echo "LIBS=${LIBS}" >> MCONFIG
28}
29
30do_compile () {
31 oe_runmake 'CC=${CC}' 'LD=${LD}' 'LDFLAGS=${LDFLAGS}'
32}
33
34do_install () {
35 install -d ${D}${bindir}
36 install -d ${D}${mandir}/man1
37 install -d ${D}${mandir}/man8
38
39 # remove strip flag
40 sed -i 's/install -s/install/' rpcinfo/Makefile
41 sed -i 's/install -s/install/' rpcgen/Makefile
42
43 oe_runmake 'INSTALLROOT=${D}' 'BINMODE=0755' \
44 'DAEMONMODE=0755' 'MANMODE=0644' \
45 'BINDIR=${bindir}' 'SBINDIR=${sbindir}' \
46 'MANDIR=${mandir}' install
47}
48ALTERNATIVE_PRIORITY = "100"
49
50ALTERNATIVE:${PN} = "rpcinfo"
51ALTERNATIVE_LINK_NAME[rpcinfo] = "${bindir}/rpcinfo"
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/CVE-2019-7282-and-CVE-2019-7283.patch b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/CVE-2019-7282-and-CVE-2019-7283.patch
deleted file mode 100644
index 285667b869..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/CVE-2019-7282-and-CVE-2019-7283.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From a7831a16c3e0e1463d5eb08a58af152cb75ca976 Mon Sep 17 00:00:00 2001
2From: Yi Zhao <yi.zhao@windriver.com>
3Date: Mon, 15 Apr 2019 06:05:58 +0000
4Subject: [PATCH] Fix CVE-2019-7282 and CVE-2019-7283
5
6Description: Fix CVE-2018-20685 and CVE-2019-6111
7Bug-Debian: https://bugs.debian.org/920486
8Origin: https://github.com/openssh/openssh-portable/commit/6010c0303a422a9c5fa8860c061bf7105eb7f8b2#diff-9f340c228413d5a9a9206ea2ed2bc624R1114
9
10Upstream-Status: Backport [Debian]
11[https://sources.debian.org/src/netkit-rsh/0.17-20/debian/patches/fix-CVE-2018-20685-and-CVE-2019-6111.patch]
12
13CVE: CVE-2019-7282 CVE-2019-7283
14
15Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
16---
17 rcp/rcp.c | 5 +++++
18 1 file changed, 5 insertions(+)
19
20diff --git a/rcp/rcp.c b/rcp/rcp.c
21index ca61c18..77d8ff8 100644
22--- a/rcp/rcp.c
23+++ b/rcp/rcp.c
24@@ -740,6 +740,11 @@ sink(int argc, char *argv[])
25 size = size * 10 + (*cp++ - '0');
26 if (*cp++ != ' ')
27 SCREWUP("size not delimited");
28+ if (*cp == '\0' || strchr(cp, '/') != NULL ||
29+ strcmp(cp, ".") == 0 || strcmp(cp, "..") == 0) {
30+ error("error: unexpected filename: %s", cp);
31+ exit(1);
32+ }
33 if (targisdir) {
34 static char *namebuf;
35 static int cursize;
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fix-host-variable.patch b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fix-host-variable.patch
deleted file mode 100644
index 1d3631d47d..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fix-host-variable.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1fix host variable when rsh is renamed to other.
2
3Upstream-Status: Pending
4
5If rsh is renamed to other, like rsh.netkit, host variable is assigned to
6rsh.netkit, which is wrong.
7
8Signed-off-by: Roy.Li <rongqing.li@windriver.com>
9---
10 rsh/rsh.c | 1 -
11 1 files changed, 0 insertions(+), 1 deletions(-)
12
13diff --git a/rsh/rsh.c b/rsh/rsh.c
14index ac594f9..11f533e 100644
15--- a/rsh/rsh.c
16+++ b/rsh/rsh.c
17@@ -100,7 +100,6 @@ main(int argc, char *argv[])
18 #else
19 if (!strcmp(p, "rsh")) asrsh = 1;
20 #endif
21- else host = p;
22
23 /* handle "rsh host flags" */
24 if (!host && argc > 2 && argv[1][0] != '-') {
25--
261.7.5.4
27
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fixup_wait3_api_change.patch b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fixup_wait3_api_change.patch
deleted file mode 100644
index c6e2e60624..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/fixup_wait3_api_change.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1Fix build issue do to Deprecate union wait and remove support from wait functions [BZ #19613]
2
3| rlogin.c: In function 'catch_child':
4| rlogin.c:463:13: error: storage size of 'status' isn't known
5| union wait status;
6
7https://sourceware.org/ml/libc-alpha/2016-02/msg00342.html
8
9Upstream-Status: Inappropriate [ no upstream maintaner ]
10
11Signed-off-by: Armin Kuster <akuster@mvista.com>
12
13Index: netkit-rsh-0.17/rlogin/rlogin.c
14===================================================================
15--- netkit-rsh-0.17.orig/rlogin/rlogin.c
16+++ netkit-rsh-0.17/rlogin/rlogin.c
17@@ -460,7 +460,7 @@ writeroob(int ignore)
18 void
19 catch_child(int ignore)
20 {
21- union wait status;
22+ int status;
23 int pid;
24
25 (void)ignore;
26@@ -471,7 +471,7 @@ catch_child(int ignore)
27 return;
28 /* if the child (reader) dies, just quit */
29 if (pid < 0 || (pid == childpid && !WIFSTOPPED(status)))
30- done((int)(status.w_termsig | status.w_retcode));
31+ done((int)(WTERMSIG(status) | WEXITSTATUS(status)));
32 }
33 /* NOTREACHED */
34 }
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/netkit-rsh-0.17-rexec-ipv6.patch b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/netkit-rsh-0.17-rexec-ipv6.patch
deleted file mode 100644
index 7afd70859f..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/netkit-rsh-0.17-rexec-ipv6.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1make rexec support ipv6
2
3Upstream-Status: Pending
4
5rexec equals rexec_af(... ,AF_INET) which only support ipv4,
6use rexec_af(..., AF_UNSPEC) to support both ipv6 and ipv4.
7
8Signed-off-by: Roy.Li <rongqing.li@windriver.com>
9---
10 rexec/rexec.c | 4 ++--
11 1 files changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/rexec/rexec.c b/rexec/rexec.c
14index 0913c02..9c8f769 100644
15--- a/rexec/rexec.c
16+++ b/rexec/rexec.c
17@@ -214,8 +214,8 @@ int main(int argc, char *argv[])
18 passwd = getpass("Password: ");
19 }
20
21- if ( (sock = rexec(&host, port_exec, user_name, passwd, command,
22- p_to_aux_sock)) < 0 )
23+ if ( (sock = rexec_af(&host, port_exec, user_name, passwd, command,
24+ p_to_aux_sock, AF_UNSPEC)) < 0 )
25 {
26 fprintf(stderr,"%s: Error in rexec system call: ",argv[0]);
27 perror(NULL);
28--
291.7.4.1
30
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/no_pam_build_fix.patch b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/no_pam_build_fix.patch
deleted file mode 100644
index fdd535be1b..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/no_pam_build_fix.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1netkit-rsh:
2Allow to build with no PAM enabled.
3
4Upstream-Status: Inappropriate [ no upstream maintaner ]
5
6Signed-off-by: Armin Kuster <akuster808@gmail.com>
7
8Index: netkit-rsh-0.17/rshd/rshd.c
9===================================================================
10--- netkit-rsh-0.17.orig/rshd/rshd.c
11+++ netkit-rsh-0.17/rshd/rshd.c
12@@ -110,9 +110,11 @@ extern char **environ;
13 static void error(const char *fmt, ...);
14 static void doit(struct sockaddr *fromp, socklen_t fromlen);
15 static char *getstr(char *, size_t, const char *);
16+#ifdef USE_PAM
17 static int err_conv(
18 int, const struct pam_message **, struct pam_response **, void *
19 );
20+#endif /* USE_PAM */
21
22 extern int _check_rhosts_file;
23
24@@ -256,6 +258,7 @@ static void stderr_parent(int sock, int
25 }
26
27
28+#ifdef USE_PAM
29 static int err_conv(
30 int num_msg, const struct pam_message **msg,
31 struct pam_response **resp, void *appdata_ptr
32@@ -266,6 +269,7 @@ static int err_conv(
33 (void) appdata_ptr;
34 return PAM_CONV_ERR;
35 }
36+#endif
37
38 static struct passwd *doauth(const char *remuser,
39 const char *hostname,
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.pam b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.pam
deleted file mode 100644
index 94e5dda50b..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.pam
+++ /dev/null
@@ -1,10 +0,0 @@
1#%PAM-1.0
2# For root login to succeed here with pam_securetty, "rexec" must be
3# listed in /etc/securetty.
4auth required pam_nologin.so
5auth required pam_env.so
6auth include common-auth
7account include common-account
8session optional pam_keyinit.so force revoke
9session include common-session
10session required pam_loginuid.so
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.xinetd.netkit b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.xinetd.netkit
deleted file mode 100644
index 7354360ae7..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rexec.xinetd.netkit
+++ /dev/null
@@ -1,20 +0,0 @@
1# default: off
2# description:
3# Rexecd is the server for the rexec program. The server provides remote
4# execution facilities with authentication based on user names and
5# passwords.
6#
7service exec
8{
9 socket_type = stream
10 protocol = tcp
11 flags = NAMEINARGS
12 wait = no
13 user = root
14 group = root
15 log_on_success += USERID
16 log_on_failure += USERID
17 server = /usr/sbin/tcpd
18 server_args = /usr/sbin/in.rexecd
19 disable = yes
20}
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.pam b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.pam
deleted file mode 100644
index b30f139cb7..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.pam
+++ /dev/null
@@ -1,12 +0,0 @@
1#%PAM-1.0
2# For root login to succeed here with pam_securetty, "rlogin" must be
3# listed in /etc/securetty.
4auth required pam_nologin.so
5auth required pam_securetty.so
6auth required pam_env.so
7auth include common-auth
8account include common-account
9password include common-password
10session optional pam_keyinit.so force revoke
11session include common-session
12session required pam_loginuid.so
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.xinetd.netkit b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.xinetd.netkit
deleted file mode 100644
index 70493e603b..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rlogin.xinetd.netkit
+++ /dev/null
@@ -1,23 +0,0 @@
1# default: off
2# description:
3# Rlogind is a server for the rlogin program. The server provides remote
4# execution with authentication based on privileged port numbers from trusted
5# host
6#
7service login
8{
9 socket_type = stream
10 protocol = tcp
11 flags = NAMEINARGS
12 wait = no
13 user = root
14 group = root
15 log_on_success += USERID
16 log_on_failure += USERID
17 server = /usr/sbin/tcpd
18 server_args = /usr/sbin/in.rlogind -a
19 disable = yes
20}
21
22
23
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh-redone_link_order_file.patch b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh-redone_link_order_file.patch
deleted file mode 100644
index ab0b9b64bc..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh-redone_link_order_file.patch
+++ /dev/null
@@ -1,77 +0,0 @@
1This fixes a build issue caused by linking order.
2
3Upstream-Status: Inappropriate
4Most distos have there own verison of this fix. This was derived by
5* Fix link order to list libraries after the objects that require them
6(LP: #771080).
7
8-- Colin Watson <cjwatson@ubuntu.com> Tue, 13 Sep 2011 10:07:08 +0100
9
10
11Signed-off-by: Armin Kuster <akuster808@gmail.com>
12
13Index: netkit-rsh-0.17/rsh/Makefile
14===================================================================
15--- netkit-rsh-0.17.orig/rsh/Makefile
16+++ netkit-rsh-0.17/rsh/Makefile
17@@ -6,7 +6,7 @@ include ../MRULES
18 OBJS = rsh.o
19
20 rsh: $(OBJS)
21- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
22+ $(CC) $^ -o $@ $(LDFLAGS) $(LIBS)
23
24 install: rsh
25 install -o root -m$(SUIDMODE) rsh $(INSTALLROOT)$(BINDIR)
26Index: netkit-rsh-0.17/rshd/Makefile
27===================================================================
28--- netkit-rsh-0.17.orig/rshd/Makefile
29+++ netkit-rsh-0.17/rshd/Makefile
30@@ -11,7 +11,7 @@ LIBS += -ldl -lpam
31 endif
32
33 rshd: $(OBJS)
34- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
35+ $(CC) $^ -o $@ $(LDFLAGS) $(LIBS)
36
37 install: rshd
38 install -m$(DAEMONMODE) rshd $(INSTALLROOT)$(SBINDIR)/in.rshd
39Index: netkit-rsh-0.17/rlogin/Makefile
40===================================================================
41--- netkit-rsh-0.17.orig/rlogin/Makefile
42+++ netkit-rsh-0.17/rlogin/Makefile
43@@ -7,7 +7,7 @@ PROG=rlogin
44 OBJS=rlogin.o
45
46 $(PROG): $(OBJS)
47- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
48+ $(CC) $^ -o $@ $(LDFLAGS) $(LIBS)
49
50 install: $(PROG)
51 install -o root -m$(SUIDMODE) $(PROG) $(INSTALLROOT)$(BINDIR)
52Index: netkit-rsh-0.17/rlogind/Makefile
53===================================================================
54--- netkit-rsh-0.17.orig/rlogind/Makefile
55+++ netkit-rsh-0.17/rlogind/Makefile
56@@ -13,7 +13,7 @@ LIBS += -ldl -lpam -lpam_misc
57 endif
58
59 rlogind: $(OBJS)
60- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
61+ $(CC) $^ -o $@ $(LDFLAGS) $(LIBS)
62
63 rlogind.o: pathnames.h logwtmp.h rlogind.h ../version.h
64 logwtmp.o: logwtmp.h
65Index: netkit-rsh-0.17/rexecd/Makefile
66===================================================================
67--- netkit-rsh-0.17.orig/rexecd/Makefile
68+++ netkit-rsh-0.17/rexecd/Makefile
69@@ -24,7 +24,7 @@ endif
70 CFLAGS += -DRESTRICT_FTP=1
71
72 rexecd: rexecd.o
73- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
74+ $(CC) $^ -o $@ $(LDFLAGS) $(LIBS)
75
76 install: rexecd
77 install -m$(DAEMONMODE) rexecd $(INSTALLROOT)$(SBINDIR)/in.rexecd
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.pam b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.pam
deleted file mode 100644
index 072327a76e..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.pam
+++ /dev/null
@@ -1,10 +0,0 @@
1#%PAM-1.0
2# For root login to succeed here with pam_securetty, "rsh" must be
3# listed in /etc/securetty.
4auth required pam_nologin.so
5auth required pam_securetty.so
6auth required pam_env.so
7account include common-account
8session optional pam_keyinit.so force revoke
9session include common-session
10session required pam_loginuid.so
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.xinetd.netkit b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.xinetd.netkit
deleted file mode 100644
index a842eb974f..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh/rsh.xinetd.netkit
+++ /dev/null
@@ -1,21 +0,0 @@
1# default: off
2# description:
3# The rshd server is a server for the rcmd(3) routine and,
4# consequently, for the rsh(1) program. The server provides
5# remote execution facilities with authentication based on
6# privileged port numbers from trusted hosts.
7#
8service shell
9{
10 socket_type = stream
11 protocol = tcp
12 flags = NAMEINARGS
13 wait = no
14 user = root
15 group = root
16 log_on_success += USERID
17 log_on_failure += USERID
18 server = /usr/sbin/tcpd
19 server_args = /usr/sbin/in.rshd -aL
20 disable = yes
21}
diff --git a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh_0.17.bb b/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh_0.17.bb
deleted file mode 100644
index 5ea553e871..0000000000
--- a/meta-networking/recipes-netkit/netkit-rsh/netkit-rsh_0.17.bb
+++ /dev/null
@@ -1,105 +0,0 @@
1DESCRIPTION = "netkit-rsh includes the rsh daemon and client."
2SECTION = "net"
3HOMEPAGE="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit"
4LICENSE = "BSD-4-Clause"
5DEPENDS = "xinetd libgcrypt virtual/crypt"
6
7LIC_FILES_CHKSUM = "file://rsh/rsh.c;endline=32;md5=487b3c637bdc181d32b2a8543d41b606"
8
9SRC_URI = "${DEBIAN_MIRROR}/main/n/netkit-rsh/netkit-rsh_${PV}.orig.tar.gz;name=archive \
10 ${DEBIAN_MIRROR}/main/n/netkit-rsh/netkit-rsh_${PV}-15.diff.gz;name=patch15 \
11 file://rsh-redone_link_order_file.patch \
12 file://no_pam_build_fix.patch \
13 file://rexec.xinetd.netkit \
14 file://rlogin.xinetd.netkit \
15 file://rsh.xinetd.netkit \
16 file://netkit-rsh-0.17-rexec-ipv6.patch \
17 file://fix-host-variable.patch \
18 file://fixup_wait3_api_change.patch \
19 file://CVE-2019-7282-and-CVE-2019-7283.patch \
20"
21
22SRC_URI[archive.md5sum] = "65f5f28e2fe22d9ad8b17bb9a10df096"
23SRC_URI[archive.sha256sum] = "edcac7fa18015f0bc04e573f3f54ae3b638d71335df1ad7dae692779914ad669"
24SRC_URI[patch15.md5sum] = "655efc0d541b03ca5de0ae506c805ea3"
25SRC_URI[patch15.sha256sum] = "2bc071c438e8b0ed42a0bd2db2d8b681b27a1e9b1798694d9874733293bc2aa9"
26
27# Other support files
28PAM_SRC_URI = "file://rexec.pam \
29 file://rlogin.pam \
30 file://rsh.pam \
31"
32SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}"
33
34inherit pkgconfig update-alternatives
35
36CFLAGS += " -D_GNU_SOURCE -Wno-deprecated-declarations"
37LDFLAGS += " -L${STAGING_LIBDIR} -lutil -lcrypt"
38
39PACKAGECONFIG ??= ""
40PACKAGECONFIG:append = " ${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
41PACKAGECONFIG[pam] = " , --without-pam, libpam, libpam"
42
43COMPATIBLE_HOST:libc-musl = 'null'
44
45do_configure () {
46 ./configure --prefix=${prefix} --exec-prefix=${exec_prefix}
47 echo "INSTALLROOT=${D}" > MCONFIG
48
49 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
50 echo "USE_PAM=1" >> MCONFIG
51 fi
52
53 # didn't want to patch these next changes
54 sed -i 's/netkit-//' ${S}/rsh/pathnames.h
55 sed -i 's/netkit-//' ${S}/rcp/pathnames.h
56}
57
58do_install () {
59 install -d ${D}${bindir}
60 install -d ${D}${sbindir}
61 install -d ${D}${mandir}/man1
62 install -d ${D}${mandir}/man8
63 install -d ${D}${sysconfdir}/xinetd.d
64
65 oe_runmake 'INSTALLROOT=${D}' 'BINMODE=0755' \
66 'DAEMONMODE=0755' 'MANMODE=0644' \
67 'SUIDMODE=4755' \
68 'BINDIR=${bindir}' 'SBINDIR=${sbindir}' \
69 'MANDIR=${mandir}' install
70
71 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
72 install -d ${D}${sysconfdir}/pam.d
73 install -m 0644 debian/hosts.equiv ${D}/${sysconfdir}
74 install -m 0644 ${WORKDIR}/rexec.pam ${D}/${sysconfdir}/pam.d/rexec
75 install -m 0644 ${WORKDIR}/rlogin.pam ${D}/${sysconfdir}/pam.d/rlogin
76 install -m 0644 ${WORKDIR}/rsh.pam ${D}/${sysconfdir}/pam.d/rsh
77 fi
78 cp ${WORKDIR}/rexec.xinetd.netkit ${D}/${sysconfdir}/xinetd.d/rexec
79 cp ${WORKDIR}/rlogin.xinetd.netkit ${D}/${sysconfdir}/xinetd.d/rlogin
80 cp ${WORKDIR}/rsh.xinetd.netkit ${D}/${sysconfdir}/xinetd.d/rsh
81}
82
83PACKAGES = "${PN}-client ${PN}-server ${PN}-doc ${BPN}-dbg"
84
85FILES:${PN}-client = "${bindir}/*"
86FILES:${PN}-server = "${sbindir}/* ${sysconfdir}"
87FILES:${PN}-doc = "${mandir}"
88FILES:${PN}-dbg = "${prefix}/src/debug \
89 ${sbindir}/.debug ${bindir}/.debug"
90
91ALTERNATIVE_PRIORITY = "80"
92ALTERNATIVE:${PN}-client = "rcp rexec rlogin rsh"
93ALTERNATIVE:${PN}-server = "rshd rexecd rlogind"
94ALTERNATIVE_LINK_NAME[server] = "${bindir}/rshd"
95ALTERNATIVE_TARGET[rshd] = "${sbindir}/in.rshd"
96ALTERNATIVE_LINK_NAME[rexecd] = "${bindir}/rexecd"
97ALTERNATIVE_TARGET[rexecd] = "${sbindir}/in.rexecd"
98ALTERNATIVE_LINK_NAME[rlogind] = "${bindir}/rlogind"
99ALTERNATIVE_TARGET[rlogind] = "${sbindir}/in.rlogind"
100
101RCONFLICTS:${PN}-server += "inetutils-rshd"
102RPROVIDES:${PN}-server = "rshd"
103
104RDEPENDS:${PN}-server = "xinetd"
105RDEPENDS:${PN}-server += "tcp-wrappers"
diff --git a/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/0001-Link-with-libtirpc.patch b/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/0001-Link-with-libtirpc.patch
deleted file mode 100644
index 3655a57162..0000000000
--- a/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/0001-Link-with-libtirpc.patch
+++ /dev/null
@@ -1,120 +0,0 @@
1From 5746b68ba9dda87586b3ac88fe84031cbc0015f7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 11 May 2018 12:20:03 -0700
4Subject: [PATCH] Link with libtirpc
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 configure | 2 +-
11 rpc.rusersd/rusers_proc.c | 7 +------
12 rpc.rusersd/rusersd.c | 6 +-----
13 rup/rup.c | 2 +-
14 4 files changed, 4 insertions(+), 13 deletions(-)
15
16--- a/configure
17+++ b/configure
18@@ -92,7 +92,6 @@ else
19 echo -n 'Checking if C compiler works... '
20 if (
21 $CC __conftest.c -o __conftest || exit 1
22- ./__conftest || exit 1
23 ) >/dev/null 2>&1; then
24 echo 'yes'
25 else
26@@ -146,8 +145,7 @@ else
27
28 fi
29
30-LDFLAGS=
31-LIBS=
32+LIBS="$LIBS -ltirpc"
33
34 rm -f __conftest*
35
36@@ -172,13 +170,11 @@ int main() {
37 EOF
38 if (
39 $CC $CFLAGS __conftest.c -o __conftest || exit 1
40- ./__conftest || exit 1
41 ) >/dev/null 2>&1; then
42 echo 'yes'
43 else
44 if (
45 $CC $CFLAGS -D__USE_BSD_SIGNAL __conftest.c -o __conftest || exit 1
46- ./__conftest || exit 1
47 ) >/dev/null 2>&1; then
48 echo '-D__USE_BSD_SIGNAL'
49 CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
50@@ -231,7 +227,6 @@ if (
51 else
52 if (
53 $CC $CFLAGS -D_GNU_SOURCE __conftest.c -o __conftest || exit 1
54- ./__conftest || exit 1
55 ) >/dev/null 2>&1; then
56 echo '-D_GNU_SOURCE'
57 CFLAGS="$CFLAGS -D_GNU_SOURCE"
58@@ -262,20 +257,17 @@ int main() {
59 EOF
60 if (
61 $CC $CFLAGS __conftest.c $LIBBSD -o __conftest || exit 1
62- ./__conftest || exit 1
63 ) >/dev/null 2>&1; then
64 echo 'ok'
65 else
66 if (
67 $CC $CFLAGS __conftest.c -lsnprintf $LIBBSD -o __conftest || exit 1
68- ./__conftest || exit 1
69 ) >/dev/null 2>&1; then
70 echo '-lsnprintf'
71 LIBS="$LIBS -lsnprintf"
72 else
73 if (
74 $CC $CFLAGS __conftest.c -ldb $LIBBSD -o __conftest || exit 1
75- ./__conftest || exit 1
76 ) >/dev/null 2>&1; then
77 echo '-ldb'
78 LIBS="$LIBS -ldb"
79--- a/rpc.rusersd/rusers_proc.c
80+++ b/rpc.rusersd/rusers_proc.c
81@@ -57,12 +57,7 @@ char rp_rcsid[] =
82 #define RUT_TIME ut_time
83 #endif
84
85-/* Glibc strikes again */
86-#ifdef __GLIBC__
87- #include <rpcsvc/rusers.h>
88-#else
89- #include "rusers.h"
90-#endif
91+#include "rusers.h"
92
93 void rusers_service(struct svc_req *rqstp, SVCXPRT *transp);
94
95--- a/rpc.rusersd/rusersd.c
96+++ b/rpc.rusersd/rusersd.c
97@@ -38,11 +38,7 @@ char rusersd_rcsid[] =
98 #include <rpc/pmap_clnt.h>
99 #include <unistd.h>
100 #include <grp.h>
101-#ifdef __GLIBC__
102- #include <rpcsvc/rusers.h>
103-#else
104- #include "rusers.h"
105-#endif
106+#include "rusers.h"
107
108 #include "../version.h"
109
110--- a/rup/rup.c
111+++ b/rup/rup.c
112@@ -48,7 +48,7 @@ char rcsid[] = "$Id: rup.c,v 1.8 2000/07
113
114 #undef FSHIFT /* Use protocol's shift and scale values */
115 #undef FSCALE
116-#include <rpcsvc/rstat.h>
117+#include "rstat.h"
118
119 #include "../version.h"
120
diff --git a/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/rpc.rusersd-Makefile-fix-parallel-build-issue.patch b/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/rpc.rusersd-Makefile-fix-parallel-build-issue.patch
deleted file mode 100644
index d85178d714..0000000000
--- a/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers/rpc.rusersd-Makefile-fix-parallel-build-issue.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From c23cc112a480f90950de5cf1de09b1a7e732bf21 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Mon, 15 Dec 2014 18:31:13 -0800
4Subject: [PATCH] rpc.rusersd/Makefile: fix parallel build issue
5
6Fixed:
7rusers.x: No such file or directory
8Makefile:44: recipe for target 'rusers_xdr.c' failed
9
10Upstream-Status: Pending
11
12Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
13---
14 rpc.rusersd/Makefile | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/rpc.rusersd/Makefile b/rpc.rusersd/Makefile
18index 792f528..65a424a 100644
19--- a/rpc.rusersd/Makefile
20+++ b/rpc.rusersd/Makefile
21@@ -40,5 +40,5 @@ rusers.x:
22 rusers.h: $(RUSERSX) rusers.x
23 $(RPCGEN) -h -o rusers.h rusers.x
24
25-rusers_xdr.c: $(RUSERSX)
26+rusers_xdr.c: $(RUSERSX) rusers.x
27 $(RPCGEN) -c -C -o rusers_xdr.c rusers.x
28--
291.7.9.5
30
diff --git a/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers_0.17.bb b/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers_0.17.bb
deleted file mode 100644
index c45cbcd925..0000000000
--- a/meta-networking/recipes-netkit/netkit-rusers/netkit-rusers_0.17.bb
+++ /dev/null
@@ -1,72 +0,0 @@
1DESCRIPTION = "netkit-rusers includes rusers - Displays who is logged in to machines on local network \
2 rusersd - Logged in users server"
3HOMEPAGE = "ftp://ftp.uk.linux.org/pub/linux/Networking/netkit"
4SECTION = "net"
5LICENSE = "BSD-3-Clause"
6LIC_FILES_CHKSUM = "file://rusers/rusers.c;beginline=2;endline=3;md5=f4fc634a4ce8c569911196b72b10770e"
7DEPENDS = " tcp-wrappers libtirpc rpcbind rpcsvc-proto rpcsvc-proto-native"
8
9SRC_URI = "http://http.debian.net/debian/pool/main/n/${BPN}/${BPN}_${PV}.orig.tar.gz;name=archive \
10 http://http.debian.net/debian/pool/main/n/${BPN}/${BPN}_${PV}-8.diff.gz;name=patch8 \
11 file://rpc.rusersd-Makefile-fix-parallel-build-issue.patch \
12 file://0001-Link-with-libtirpc.patch \
13"
14
15SRC_URI[archive.md5sum] = "dc99a80b9fde2ab427c874f88f1c1602"
16SRC_URI[archive.sha256sum] = "f00138651865ad2dcfec5dedda0cda403cb80c4ab68efcc3bbccafe198c24b6d"
17SRC_URI[patch8.md5sum] = "1ff498113e0f920d92088092e5570bdc"
18SRC_URI[patch8.sha256sum] = "14882dbdda4e37baa84d55b54b46c7e063a20fc9e04d1be1a2807643cd0f3067"
19
20CFLAGS += "-I${STAGING_INCDIR}/tirpc"
21
22EXTRA_OEMAKE = "RUSERSX=${STAGING_INCDIR}/rpcsvc/rusers.x"
23
24do_configure () {
25 ./configure --prefix=${prefix} --installroot=${D} --with-c-compiler="${CC}"
26}
27
28do_install () {
29 install -d ${D}${bindir}
30 install -d ${D}${sbindir}
31 install -d ${D}${mandir}/man1
32 install -d ${D}${mandir}/man8
33 install -d ${D}${sysconfdir}/xinetd.d
34
35 sed -i 's/install -s/install/' rusers/Makefile
36 sed -i 's/install -s/install/' rup/Makefile
37 sed -i 's/install -s/install/' rpc.rusersd/Makefile
38
39 oe_runmake 'INSTALLROOT=${D}' 'BINMODE=0755' \
40 'DAEMONMODE=0755' 'MANMODE=0644' \
41 'BINDIR=${bindir}' 'SBINDIR=${sbindir}' \
42 'MANDIR=${mandir}' install
43
44 # create the xinetd config file
45 cat >rusersd.conf <<EOF
46 service rusersd
47 {
48 disable = yes
49 type = RPC
50 rpc_version = 1-2
51 socket_type = dgram
52 protocol = udp
53 wait = yes
54 user = root
55 server = ${sbindir}/rpc.rusersd
56 }
57EOF
58 install rusersd.conf ${D}/${sysconfdir}/xinetd.d/rusersd
59}
60
61PACKAGES = "${PN}-client ${PN}-server ${PN}-doc ${BPN}-dbg"
62FILES:${PN}-client = "${bindir}/*"
63FILES:${PN}-server = "${sbindir}/* ${sysconfdir}"
64FILES:${PN}-doc = "${mandir}"
65FILES:${PN}-dbg = "${prefix}/src/debug \
66 ${bindir}/.debug ${sbindir}/.debug"
67
68RDEPENDS:${PN}-server += "tcp-wrappers xinetd rpcbind"
69
70# http://errors.yoctoproject.org/Errors/Details/186962/
71COMPATIBLE_HOST:libc-musl = 'null'
72SKIP_RECIPE[netkit-rusers] ?= "Fails to build rup.c:51:10: fatal error: rstat.h: No such file or directory"
diff --git a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0001-Add-missing-include-path-to-I-options.patch b/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0001-Add-missing-include-path-to-I-options.patch
deleted file mode 100644
index b1325b3173..0000000000
--- a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0001-Add-missing-include-path-to-I-options.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From 55ab6f1389261edff5f4c942bc3b0d8e695856d7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 30 Aug 2017 18:11:33 -0700
4Subject: [PATCH 1/2] Add missing include path to -I options
5
6Fixes errors like
7| rwho.c:52:10: fatal error: 'protocols/rwhod.h' file not found
8| #include <protocols/rwhod.h>
9| ^~~~~~~~~~~~~~~~~~~
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13Upstream-Status: Pending
14
15 rwho/Makefile | 1 +
16 rwhod/Makefile | 2 ++
17 2 files changed, 3 insertions(+)
18
19diff --git a/rwho/Makefile b/rwho/Makefile
20index 6f86388..67b28d4 100644
21--- a/rwho/Makefile
22+++ b/rwho/Makefile
23@@ -6,6 +6,7 @@ include ../MRULES
24 rwho: rwho.o
25 $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
26
27+CFLAGS += -I../include
28 rwho.o: ../version.h
29
30 install: rwho
31diff --git a/rwhod/Makefile b/rwhod/Makefile
32index 772b641..9034218 100644
33--- a/rwhod/Makefile
34+++ b/rwhod/Makefile
35@@ -7,6 +7,8 @@ ifneq ($(USE_GLIBC),1)
36 CFLAGS += -D_GNU_SOURCE
37 endif
38
39+CFLAGS += -I../include
40+
41 OBJS = rwhod.o
42
43 rwhod: $(OBJS)
44--
452.14.1
46
diff --git a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0002-Fix-build-issues-found-with-musl.patch b/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0002-Fix-build-issues-found-with-musl.patch
deleted file mode 100644
index 349a1351fe..0000000000
--- a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/0002-Fix-build-issues-found-with-musl.patch
+++ /dev/null
@@ -1,72 +0,0 @@
1From 2108213242638fa355f662382f55495d91301858 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 30 Aug 2017 18:13:17 -0700
4Subject: [PATCH 2/2] Fix build issues found with musl
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 ruptime/ruptime.c | 1 +
11 rwho/rwho.c | 1 +
12 rwhod/rwhod.c | 5 +++--
13 3 files changed, 5 insertions(+), 2 deletions(-)
14
15--- a/ruptime/ruptime.c
16+++ b/ruptime/ruptime.c
17@@ -53,6 +53,7 @@ char ruptime_rcsid[] =
18 #include <string.h>
19 #include <errno.h>
20 #include <time.h>
21+#include <fcntl.h>
22
23 struct hs {
24 char hs_hostname[MAXHOSTNAMELEN];
25--- a/rwho/rwho.c
26+++ b/rwho/rwho.c
27@@ -49,6 +49,7 @@ char rcsid[] = "$Id: rwho.c,v 1.7 1999/0
28 #include <assert.h>
29 #include <stdio.h>
30 #include <time.h>
31+#include <fcntl.h>
32 #include <protocols/rwhod.h>
33
34 #include "../version.h"
35--- a/rwhod/rwhod.c
36+++ b/rwhod/rwhod.c
37@@ -76,6 +76,7 @@ char rcsid[] =
38 #include <grp.h>
39 #include <time.h>
40 #include <stdint.h>
41+#include <fcntl.h>
42
43 #include "../version.h"
44
45@@ -102,7 +103,7 @@ struct nlist nl[] = {
46 static void broadcaster(void);
47 static int configure(int s);
48 static int verify(const char *name);
49-#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
50+#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2))
51 static int getloadavg(double ptr[3], int n);
52 #endif
53
54@@ -549,7 +550,7 @@ sendpacket(struct whod *wd)
55 }
56 }
57
58-#if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2)
59+#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 2))
60 /*
61 * Taken from:
62 *
63--- a/include/protocols/rwhod.h
64+++ b/include/protocols/rwhod.h
65@@ -37,6 +37,7 @@
66 #ifndef _RWHOD_H_
67 #define _RWHOD_H_
68
69+#include <stdint.h>
70 /*
71 * rwho protocol packet format.
72 */
diff --git a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod b/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod
deleted file mode 100755
index f6419032e8..0000000000
--- a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod
+++ /dev/null
@@ -1,71 +0,0 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: rwhod
5# Required-Start: $network $remote_fs $syslog
6# Required-Stop: $network $remote_fs $syslog
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: Server for rwho and ruptime services
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/bin:/usr/sbin
13
14DAEMON=/usr/sbin/rwhod
15PIDFILE=/var/run/rwhod.pid
16CONF_FILE="/etc/default/rwhod"
17DESC="Who daemon "
18# default options. Change them in /etc/default/rwhod
19RWHOD_OPTIONS="-b"
20
21# rwhod init.d script for ntpdc from ntp.isc.org
22test -f $DAEMON || exit 0
23
24# Source function library.
25. /etc/init.d/functions
26
27[ -r $CONF_FILE ] && . $CONF_FILE
28
29startdaemon(){
30 echo -n "Starting $DESC" " rwhod "
31 start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON -- $RWHOD_OPTIONS
32 echo "done"
33}
34stopdaemon(){
35 echo -n "Stopping $DESC" " rwhod "
36 start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
37 echo "done"
38}
39
40case "$1" in
41 start)
42 startdaemon
43 ;;
44 stop)
45 stopdaemon
46 ;;
47 force-reload)
48 stopdaemon
49 startdaemon
50 ;;
51 restart)
52 stopdaemon
53 sleep 1
54 startdaemon
55 ;;
56 reload)
57 stopdaemon
58 sleep 1
59 startdaemon
60 ;;
61 status)
62 status /usr/sbin/rwhod;
63 exit $?
64 ;;
65 *)
66 echo "Usage: rwhod { start | stop | status | restart | reload }" >&2
67 exit 1
68 ;;
69esac
70
71exit 0
diff --git a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod.default b/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod.default
deleted file mode 100644
index 62d3a942d0..0000000000
--- a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho/rwhod.default
+++ /dev/null
@@ -1,2 +0,0 @@
1#Options for the rwhod daemon.
2RWHOD_OPTIONS="-b"
diff --git a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho_0.17.bb b/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho_0.17.bb
deleted file mode 100644
index 51168f958e..0000000000
--- a/meta-networking/recipes-netkit/netkit-rwho/netkit-rwho_0.17.bb
+++ /dev/null
@@ -1,108 +0,0 @@
1DESCRIPTION = "netkit-rwho includes, ruptime rwho and rwhod (Daemon to maintain data for rwho/ruptime)"
2HOMEPAGE = "ftp://ftp.uk.linux.org/pub/linux/Networking/netkit"
3SECTION = "net"
4LICENSE = "BSD-4-Clause"
5LIC_FILES_CHKSUM = "file://rwho/rwho.c;beginline=2;endline=3;md5=5a85f13c0142d72fc378e00f15da5b9e"
6
7SRC_URI = "${DEBIAN_MIRROR}/main/n/netkit-rwho/netkit-rwho_${PV}.orig.tar.gz;name=archive \
8 ${DEBIAN_MIRROR}/main/n/netkit-rwho/netkit-rwho_${PV}-13.debian.tar.gz;subdir=${BP};name=patch13 \
9 file://rwhod \
10 file://rwhod.default \
11 file://0001-Add-missing-include-path-to-I-options.patch \
12 file://0002-Fix-build-issues-found-with-musl.patch \
13 "
14SRC_URI[archive.md5sum] = "0f71620d45d472f89134ba0d74242e75"
15SRC_URI[archive.sha256sum] = "0409e2ce4bfdb2dacb2c193d0fedfc49bb975cb057c5c6b0ffcca603a1188da7"
16SRC_URI[patch13.md5sum] = "82ed5a3c6b0bbf00b36508b9787963b9"
17SRC_URI[patch13.sha256sum] = "53aefa27d98b565bf756db57120c03bd224a238e45699d92076420272a6eba8e"
18
19inherit autotools-brokensep useradd update-rc.d update-alternatives
20
21CFLAGS += " -D_GNU_SOURCE"
22
23# Unlike other Debian packages, net-tools *.diff.gz contains another series of
24# patches maintained by quilt. So manually apply them before applying other local
25# patches. Also remove all temp files before leaving, because do_patch() will pop
26# up all previously applied patches in the start
27do_patch[depends] += "quilt-native:do_populate_sysroot"
28netkit_do_patch() {
29 cd ${S}
30 # it's important that we only pop the existing patches when they've
31 # been applied, otherwise quilt will climb the directory tree
32 # and reverse out some completely different set of patches
33 if [ -d ${S}/patches ]; then
34 # whilst this is the default directory, doing it like this
35 # defeats the directory climbing that quilt will otherwise
36 # do; note the directory must exist to defeat this, hence
37 # the test inside which we operate
38 QUILT_PATCHES=${S}/patches quilt pop -a
39 fi
40 if [ -d ${S}/.pc-${BPN} ]; then
41 rm -rf ${S}/.pc
42 mv ${S}/.pc-${BPN} ${S}/.pc
43 QUILT_PATCHES=${S}/debian/patches quilt pop -a
44 rm -rf ${S}/.pc ${S}/debian
45 fi
46 QUILT_PATCHES=${S}/debian/patches quilt push -a
47 mv ${S}/.pc ${S}/.pc-${BPN}
48}
49
50do_unpack[cleandirs] += "${S}"
51
52python do_patch() {
53 bb.build.exec_func('netkit_do_patch', d)
54 bb.build.exec_func('patch_do_patch', d)
55}
56
57do_configure () {
58 ./configure --prefix=${prefix}
59 echo "LDFLAGS=${LDFLAGS}" >> MCONFIG
60}
61
62do_install () {
63 # rwho & ruptime
64 install -d ${D}${bindir}
65 install -d ${D}${mandir}/man1
66 #rwhod
67 install -d ${D}${sbindir}
68 install -d ${D}${mandir}/man8
69 install -d ${D}${sysconfdir}/init.d
70 install -d ${D}${sysconfdir}/default
71 sed -i 's/install -s/install/' rwho/Makefile
72 sed -i 's/install -s/install/' ruptime/Makefile
73 sed -i 's/install -s/install/' rwhod/Makefile
74 oe_runmake 'INSTALLROOT=${D}' 'BINMODE=0755' \
75 'DAEMONMODE=0755' 'MANMODE=0644' \
76 'BINDIR=${bindir}' 'SBINDIR=${sbindir}' \
77 'MANDIR=${mandir}' install
78
79 install -m 0644 ${WORKDIR}/rwhod.default ${D}${sysconfdir}/default/rwhod
80 install -m 755 ${WORKDIR}/rwhod ${D}${sysconfdir}/init.d
81
82 mkdir -p -m 755 ${D}${localstatedir}/spool/rwho
83 chown -R rwhod ${D}${localstatedir}/spool/rwho
84}
85pkg_postinst_ontarget:${PN}-server() {
86 ${sysconfdir}/init.d/rwhod start
87}
88
89pkg_postrm:${PN}-server() {
90 ${sysconfdir}/init.d/rwhod stop
91}
92
93INITSCRIPT_NAME = "rwhod"
94INITSCRIPT_PARAM = "defaults 85 15"
95
96USERADD_PACKAGES = "${PN}-server"
97GROUPADD_PARAM:${PN}-server = "--system rwhod"
98USERADD_PARAM:${PN}-server = "--system -g rwhod --home-dir ${localstatedir}/spool/rwho \
99 --no-create-home --shell /bin/false rwhod"
100
101INSANE_SKIP:${PN} = "already-stripped"
102
103PACKAGES = "${PN}-client ${PN}-server ${PN}-doc ${BPN}-dbg"
104FILES:${PN}-client = "${bindir}/*"
105FILES:${PN}-server = "${sbindir}/* ${localstatedir} ${sysconfdir}/default/* ${sysconfdir}/init.d/*"
106FILES:${PN}-doc = "${mandir}"
107FILES:${PN}-dbg = "${prefix}/src/debug \
108 ${bindir}/.debug ${sbindir}/.debug"
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/0001-Drop-using-register-keyword.patch b/meta-networking/recipes-netkit/netkit-telnet/files/0001-Drop-using-register-keyword.patch
deleted file mode 100644
index f508711d34..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/0001-Drop-using-register-keyword.patch
+++ /dev/null
@@ -1,457 +0,0 @@
1From af89f36fbeb5f6a078b349eed8fc4ad6fbfdf5d1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 16 Jan 2023 15:26:12 -0800
4Subject: [PATCH] Drop using register keyword
5
6Its gone since c++17
7
8Fixes
9error: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
10| register char c;
11| ^~~~~~~~~
12
13Upstream-Status: Pending
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 telnet/commands.cc | 14 +++++++-------
17 telnet/defines.h | 1 +
18 telnet/sys_bsd.cc | 2 +-
19 telnet/telnet.cc | 18 +++++++++---------
20 telnet/terminal.cc | 4 ++--
21 telnet/tn3270.cc | 4 ++--
22 telnet/tn3270.o | Bin 4008 -> 4008 bytes
23 telnet/utilities.cc | 6 +++---
24 telnetd/setproctitle.c | 6 +++---
25 telnetd/slc.c | 4 ++--
26 telnetd/state.c | 12 ++++++------
27 telnetd/sys_term.c | 4 ++--
28 telnetd/telnetd.c | 4 ++--
29 telnetd/termstat.c | 4 ++--
30 telnetd/utility.c | 16 ++++++++--------
31 15 files changed, 50 insertions(+), 49 deletions(-)
32
33--- a/telnet/commands.cc
34+++ b/telnet/commands.cc
35@@ -192,8 +192,8 @@ static int margc;
36 static const char *margv[20];
37
38 static void makeargv(void) {
39- register char *cp, *cp2, c;
40- register const char **argp = margv;
41+ char *cp, *cp2, c;
42+ const char **argp = margv;
43
44 margc = 0;
45 cp = line;
46@@ -204,7 +204,7 @@ static void makeargv(void) {
47 cp++;
48 }
49 while ((c = *cp)!=0) {
50- register int inquote = 0;
51+ int inquote = 0;
52 while (isspace(c))
53 c = *++cp;
54 if (c == '\0')
55@@ -281,7 +281,7 @@ static const char *control(cc_t c)
56 * was to assign "c" to an unsigned int variable...
57 * Arggg....
58 */
59- register unsigned int uic = (unsigned int)c;
60+ unsigned int uic = (unsigned int)c;
61
62 if (uic == 0x7f)
63 return ("^?");
64@@ -479,7 +479,7 @@ int send_tncmd(int (*func)(int, int), co
65 long opt;
66
67 if (isprefix(name, "help") || isprefix(name, "?")) {
68- register int col, len;
69+ int col, len;
70
71 printf("Usage: send %s <option>\n", cmd);
72 printf("Valid options are:\n\t");
73@@ -2212,8 +2212,8 @@ static unsigned long sourceroute(char *a
74 static char lsr[44];
75 char *cp, *cp2, *lsrp, *lsrep;
76 struct in_addr sin_addr;
77- register struct hostent *host = 0;
78- register char c;
79+ struct hostent *host = 0;
80+ char c;
81
82 /*
83 * Verify the arguments, and make sure we have
84--- a/telnet/defines.h
85+++ b/telnet/defines.h
86@@ -52,3 +52,4 @@
87 #define CONTROL(x) ((x)&0x1f) /* CTRL(x) is not portable */
88
89 #define MODE_OUT8 0x8000 /* binary mode sans -opost */
90+
91--- a/telnet/sys_bsd.cc
92+++ b/telnet/sys_bsd.cc
93@@ -285,7 +285,7 @@ void sys_telnet_init(void) {
94 int process_rings(int netin, int netout, int netex, int ttyin, int ttyout,
95 int poll /* If 0, then block until something to do */)
96 {
97- register int c, maxfd;
98+ int c, maxfd;
99 /* One wants to be a bit careful about setting returnValue
100 * to one, since a one implies we did some useful work,
101 * and therefore probably won't be called to block next
102--- a/telnet/telnet.cc
103+++ b/telnet/telnet.cc
104@@ -864,7 +864,7 @@ struct spc {
105 static int slc_mode = SLC_EXPORT;
106
107 void slc_init(void) {
108- register struct spc *spcp;
109+ struct spc *spcp;
110
111 localchars = 1;
112 for (spcp = spc_data; spcp < &spc_data[NSLC+1]; spcp++) {
113@@ -944,7 +944,7 @@ void slc_import(int def) {
114 }
115
116 void slc_export(void) {
117- register struct spc *spcp;
118+ struct spc *spcp;
119
120 TerminalDefaultChars();
121
122@@ -966,8 +966,8 @@ void slc_export(void) {
123 }
124
125 void slc(unsigned char *cp, int len) {
126- register struct spc *spcp;
127- register int func,level;
128+ struct spc *spcp;
129+ int func,level;
130
131 slc_start_reply();
132
133@@ -1032,7 +1032,7 @@ void slc(unsigned char *cp, int len) {
134 }
135
136 void slc_check(void) {
137- register struct spc *spcp;
138+ struct spc *spcp;
139
140 slc_start_reply();
141 for (spcp = &spc_data[1]; spcp < &spc_data[NSLC+1]; spcp++) {
142@@ -1080,7 +1080,7 @@ void slc_add_reply(int func, int flags,
143 }
144
145 void slc_end_reply(void) {
146- register int len;
147+ int len;
148
149 *slc_replyp++ = IAC;
150 *slc_replyp++ = SE;
151@@ -1200,7 +1200,7 @@ void env_opt_add(const char *ep) {
152 tp = opt_replyp + (vp ? strlen(vp) * 2 : 0) + strlen(ep) * 2 + 6;
153 if (tp > opt_replyend)
154 {
155- register int len;
156+ int len;
157 len = ((tp - opt_reply) + OPT_REPLY_SIZE - 1) & ~(OPT_REPLY_SIZE - 1);
158 opt_replyend = opt_reply + len;
159 opt_reply = (unsigned char *)realloc(opt_reply, len);
160@@ -1236,7 +1236,7 @@ void env_opt_add(const char *ep) {
161 }
162
163 void env_opt_end(int emptyok) {
164- register int len;
165+ int len;
166
167 len = opt_replyp - opt_reply + 2;
168 if (emptyok || len > 6) {
169@@ -1874,7 +1874,7 @@ static unsigned char *nextitem(unsigned
170
171 static void netclear(void) {
172 #if 0 /* XXX */
173- register char *thisitem, *next;
174+ char *thisitem, *next;
175 char *good;
176 #define wewant(p) ((nfrontp > p) && (*p == IAC) && \
177 (p[1] != EC) && (p[1] != EL))
178--- a/telnet/terminal.cc
179+++ b/telnet/terminal.cc
180@@ -569,8 +569,8 @@ struct termspeeds {
181 };
182
183 void TerminalSpeeds(long *ispeed, long *ospeed) {
184- register struct termspeeds *tp;
185- register long in, out;
186+ struct termspeeds *tp;
187+ long in, out;
188
189 out = cfgetospeed(&old_tc);
190 in = cfgetispeed(&old_tc);
191--- a/telnet/tn3270.cc
192+++ b/telnet/tn3270.cc
193@@ -103,7 +103,7 @@ void init_3270(void) {
194 * done: is this the last of a logical block
195 */
196 int DataToNetwork(char *buffer, int count, int done) {
197- register int loop, c;
198+ int loop, c;
199 int origCount;
200
201 origCount = count;
202@@ -179,7 +179,7 @@ void outputPurge(void) {
203 * count: how much to send
204 */
205 int DataToTerminal(char *buffer, int count) {
206- register int c;
207+ int c;
208 int origCount;
209
210 origCount = count;
211--- a/telnet/utilities.cc
212+++ b/telnet/utilities.cc
213@@ -252,7 +252,7 @@ void optionstatus(void) {
214 /* pointer: where suboption data sits */
215 /* length: length of suboption data */
216 void printsub(int direction, unsigned char *pointer, int length) {
217- register int i = 0;
218+ int i = 0;
219
220 extern int want_status_response;
221
222@@ -262,7 +262,7 @@ void printsub(int direction, unsigned ch
223 fprintf(NetTrace, "%s IAC SB ",
224 (direction == '<')? "RCVD":"SENT");
225 if (length >= 3) {
226- register int j;
227+ int j;
228
229 i = pointer[length-2];
230 j = pointer[length-1];
231@@ -577,7 +577,7 @@ void printsub(int direction, unsigned ch
232 fprintf(NetTrace, "INFO ");
233 env_common:
234 {
235- register int noquote = 2;
236+ int noquote = 2;
237 for (i = 2; i < length; i++ ) {
238 switch (pointer[i]) {
239 case ENV_VAR:
240--- a/telnetd/setproctitle.c
241+++ b/telnetd/setproctitle.c
242@@ -76,7 +76,7 @@ static char Argv0[128]; /* program nam
243 void
244 initsetproctitle(int argc, char **argv, char **envp)
245 {
246- register int i;
247+ int i;
248 char *tmp;
249
250 /*
251@@ -111,8 +111,8 @@ initsetproctitle(int argc, char **argv,
252 void
253 setproctitle(const char *fmt, ...)
254 {
255- register char *p;
256- register int i=0;
257+ char *p;
258+ int i=0;
259 static char buf[2048];
260 va_list ap;
261
262--- a/telnetd/slc.c
263+++ b/telnetd/slc.c
264@@ -196,7 +196,7 @@ int end_slc(unsigned char **bufp) {
265 * Figure out what to do about the client's slc
266 */
267 void process_slc(unsigned char func, unsigned char flag, cc_t val) {
268- register int hislevel, mylevel, ack;
269+ int hislevel, mylevel, ack;
270
271 /*
272 * Ensure that we know something about this function
273@@ -260,7 +260,7 @@ void process_slc(unsigned char func, uns
274 * Compare client's request with what we are capable of supporting.
275 */
276 void change_slc(char func, char flag, cc_t val) {
277- register int hislevel, mylevel;
278+ int hislevel, mylevel;
279
280 hislevel = flag & SLC_LEVELBITS;
281 mylevel = slctab[func].defset.flag & SLC_LEVELBITS;
282--- a/telnetd/state.c
283+++ b/telnetd/state.c
284@@ -79,7 +79,7 @@ unsigned char subbuffer[512], *subpointe
285 #define TS_DONT 8 /* dont " */
286
287 void telrcv(void) {
288- register int c;
289+ int c;
290 static int state = TS_DATA;
291
292 while (ncc > 0) {
293@@ -1081,7 +1081,7 @@ void suboption(void) {
294
295 #ifdef LINEMODE
296 case TELOPT_LINEMODE: {
297- register int request;
298+ int request;
299
300 if (his_state_is_wont(TELOPT_LINEMODE)) /* Ignore if option disabled */
301 break;
302@@ -1158,8 +1158,8 @@ void suboption(void) {
303 } /* end of case TELOPT_XDISPLOC */
304
305 case TELOPT_ENVIRON: {
306- register int c;
307- register char *cp, *varp, *valp;
308+ int c;
309+ char *cp, *varp, *valp;
310
311 if (SB_EOF())
312 return;
313@@ -1299,8 +1299,8 @@ static void doclientstat(void) {
314
315 void send_status(void) {
316 unsigned char statusbuf[256];
317- register unsigned char *ncp;
318- register unsigned char i;
319+ unsigned char *ncp;
320+ unsigned char i;
321
322 ncp = statusbuf;
323
324--- a/telnetd/sys_term.c
325+++ b/telnetd/sys_term.c
326@@ -413,7 +413,7 @@ extern int def_tspeed, def_rspeed;
327
328 static int getptyslave(void) {
329 #if 0
330- register int t = -1;
331+ int t = -1;
332
333 # ifdef LINEMODE
334 int waslm;
335@@ -505,7 +505,7 @@ static int getptyslave(void) {
336 * making sure that we have a clean tty.
337 */
338 static int cleanopen(char *lyne) {
339- register int t;
340+ int t;
341
342 /*
343 * Make sure that other people can't open the
344--- a/telnetd/telnetd.c
345+++ b/telnetd/telnetd.c
346@@ -93,7 +93,7 @@ main(int argc, char *argv[], char *env[]
347 struct sockaddr_in from;
348 int on = 1;
349 socklen_t fromlen;
350- register int ch;
351+ int ch;
352
353 #if defined(HAS_IPPROTO_IP) && defined(IP_TOS)
354 int tos = -1;
355@@ -837,7 +837,7 @@ void telnet(int f, int p)
356
357 #ifdef TIOCNOTTY
358 {
359- register int t;
360+ int t;
361 t = open(_PATH_TTY, O_RDWR);
362 if (t >= 0) {
363 (void) ioctl(t, TIOCNOTTY, (char *)0);
364--- a/telnetd/termstat.c
365+++ b/telnetd/termstat.c
366@@ -347,7 +347,7 @@ done:
367 * at a time, and if using kludge linemode, then only linemode may be
368 * affected.
369 */
370-void clientstat(register int code, register int parm1, register int parm2)
371+void clientstat(int code, register int parm1, register int parm2)
372 {
373 /*
374 * Get a copy of terminal characteristics.
375@@ -419,7 +419,7 @@ void clientstat(register int code, regis
376
377 case LM_MODE:
378 {
379- register int ack, changed;
380+ int ack, changed;
381
382 /*
383 * Client has sent along a mode mask. If it agrees with
384--- a/telnetd/utility.c
385+++ b/telnetd/utility.c
386@@ -189,7 +189,7 @@ nextitem(char *current, const char *endp
387 return current+3 <= endp ? current+3 : NULL;
388 case SB: /* loop forever looking for the SE */
389 {
390- register char *look = current+2;
391+ char *look = current+2;
392
393 while (look < endp) {
394 if ((*look++&0xff) == IAC) {
395@@ -224,7 +224,7 @@ nextitem(char *current, const char *endp
396 */
397 void netclear(void)
398 {
399- register char *thisitem, *next;
400+ char *thisitem, *next;
401 char *good;
402 #define wewant(p) ((nfrontp > p) && ((*p&0xff) == IAC) && \
403 (nfrontp > p+1 && (((*(p+1)&0xff) != EC) && ((*(p+1)&0xff) != EL))))
404@@ -354,7 +354,7 @@ netflush(void)
405 * ptr - A pointer to a character string to write
406 * len - How many bytes to write
407 */
408-void writenet(register unsigned char *ptr, register int len)
409+void writenet(unsigned char *ptr, register int len)
410 {
411 /* flush buffer if no room for new data) */
412 if ((&netobuf[BUFSIZ] - nfrontp) < len) {
413@@ -589,7 +589,7 @@ printoption(const char *fmt, int option)
414 void
415 printsub(char direction, unsigned char *pointer, int length)
416 {
417- register int i = -1;
418+ int i = -1;
419 #ifdef AUTHENTICATE
420 char buf[512];
421 #endif
422@@ -601,7 +601,7 @@ printsub(char direction, unsigned char *
423 netoprintf("td: %s suboption ",
424 direction == '<' ? "recv" : "send");
425 if (length >= 3) {
426- register int j;
427+ int j;
428
429 i = pointer[length-2];
430 j = pointer[length-1];
431@@ -817,7 +817,7 @@ printsub(char direction, unsigned char *
432
433 case TELOPT_STATUS: {
434 const char *cp;
435- register int j, k;
436+ int j, k;
437
438 netoprintf("STATUS");
439
440@@ -914,7 +914,7 @@ printsub(char direction, unsigned char *
441 netoprintf("INFO ");
442 env_common:
443 {
444- register int noquote = 2;
445+ int noquote = 2;
446 for (i = 2; i < length; i++ ) {
447 switch (pointer[i]) {
448 case ENV_VAR:
449@@ -1125,7 +1125,7 @@ printsub(char direction, unsigned char *
450 void
451 printdata(const char *tag, const char *ptr, int cnt)
452 {
453- register int i;
454+ int i;
455 char xbuf[30];
456
457 while (cnt) {
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-deadlock-on-cleanup.patch b/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-deadlock-on-cleanup.patch
deleted file mode 100644
index afcc66dada..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-deadlock-on-cleanup.patch
+++ /dev/null
@@ -1,116 +0,0 @@
1From 06ed6a6bf25a22902846097d6b6c97e070c2c326 Mon Sep 17 00:00:00 2001
2From: Seiichi Ishitsuka <ishitsuka.sc@ncos.nec.co.jp>
3Date: Fri, 1 Jun 2018 14:27:35 +0900
4Subject: [PATCH] telnetd: Fix deadlock on cleanup
5
6The cleanup function in telnetd is called both directly and on SIGCHLD
7signals. This, unfortunately, triggered a deadlock in eglibc 2.9 while
8running on a 2.6.31.11 kernel.
9
10What we were seeing is hangs like these:
11
12 (gdb) bt
13 #0 0xb7702424 in __kernel_vsyscall ()
14 #1 0xb7658e61 in __lll_lock_wait_private () from ./lib/libc.so.6
15 #2 0xb767e7b5 in _L_lock_15 () from ./lib/libc.so.6
16 #3 0xb767e6e0 in utmpname () from ./lib/libc.so.6
17 #4 0xb76bcde7 in logout () from ./lib/libutil.so.1
18 #5 0x0804c827 in cleanup ()
19 #6 <signal handler called>
20 #7 0xb7702424 in __kernel_vsyscall ()
21 #8 0xb7641003 in __fcntl_nocancel () from ./lib/libc.so.6
22 #9 0xb767e0c3 in getutline_r_file () from ./lib/libc.so.6
23 #10 0xb767d675 in getutline_r () from ./lib/libc.so.6
24 #11 0xb76bce42 in logout () from ./lib/libutil.so.1
25 #12 0x0804c827 in cleanup ()
26 #13 0x0804a0b5 in telnet ()
27 #14 0x0804a9c3 in main ()
28
29and what has happened here is that the user closes the telnet session
30via the escape character. This causes telnetd to call cleanup in frame
31the SIGCHLD signal is delivered while telnetd is executing cleanup.
32
33Telnetd then calls the signal handler for SIGCHLD, which is cleanup().
34Ouch. The actual deadlock is in libc. getutline_r in frame #10 gets the
35__libc_utmp_lock lock, and utmpname above does the same thing in frame
36
37The fix registers the SIGCHLD handler as cleanup_sighandler, and makes
38cleanup disable the SIGCHLD signal before calling cleanup_sighandler.
39
40Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
41
42The patch was imported from the Ubuntu netkit-telnet package.
43(https://bugs.launchpad.net/ubuntu/+source/netkit-telnet/+bug/507455)
44
45A previous patch declaring attributes of functions, but it is not used
46in upstream.
47
48Signed-off-by: Seiichi Ishitsuka <ishitsuka.sc@ncos.nec.co.jp>
49---
50Upstream-Status: Pending
51
52 telnetd/ext.h | 1 +
53 telnetd/sys_term.c | 17 ++++++++++++++++-
54 telnetd/telnetd.c | 2 +-
55 3 files changed, 18 insertions(+), 2 deletions(-)
56
57diff --git a/telnetd/ext.h b/telnetd/ext.h
58index b98d6ec..08f9d07 100644
59--- a/telnetd/ext.h
60+++ b/telnetd/ext.h
61@@ -97,6 +97,7 @@ void add_slc(int, int, int);
62 void check_slc(void);
63 void change_slc(int, int, int);
64 void cleanup(int);
65+void cleanup_sighandler(int);
66 void clientstat(int, int, int);
67 void copy_termbuf(char *, int);
68 void deferslc(void);
69diff --git a/telnetd/sys_term.c b/telnetd/sys_term.c
70index 5b4aa84..c4fb0f7 100644
71--- a/telnetd/sys_term.c
72+++ b/telnetd/sys_term.c
73@@ -719,7 +719,7 @@ static void addarg(struct argv_stuff *avs, const char *val) {
74 * This is the routine to call when we are all through, to
75 * clean up anything that needs to be cleaned up.
76 */
77-void cleanup(int sig) {
78+void cleanup_sighandler(int sig) {
79 char *p;
80 (void)sig;
81
82@@ -742,3 +742,18 @@ void cleanup(int sig) {
83 shutdown(net, 2);
84 exit(0);
85 }
86+
87+void cleanup(int sig) {
88+ sigset_t mask, oldmask;
89+
90+ /* Set up the mask of signals to temporarily block. */
91+ sigemptyset (&mask);
92+ sigaddset (&mask, SIGCHLD);
93+
94+ /* Block SIGCHLD while running cleanup */
95+ sigprocmask (SIG_BLOCK, &mask, &oldmask);
96+
97+ cleanup_sighandler(sig);
98+ /* Technically not needed since cleanup_sighandler exits */
99+ sigprocmask (SIG_UNBLOCK, &mask, NULL);
100+}
101diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
102index 9ace838..788919c 100644
103--- a/telnetd/telnetd.c
104+++ b/telnetd/telnetd.c
105@@ -833,7 +833,7 @@ void telnet(int f, int p)
106 signal(SIGTTOU, SIG_IGN);
107 #endif
108
109- signal(SIGCHLD, cleanup);
110+ signal(SIGCHLD, cleanup_sighandler);
111
112 #ifdef TIOCNOTTY
113 {
114--
1152.7.4
116
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-print-format-strings.patch b/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-print-format-strings.patch
deleted file mode 100644
index 755b882b67..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnet-telnetd-Fix-print-format-strings.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From 7a3095d1e9b7c73f9dca56250f433bcfc7cb660e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Jun 2017 10:15:34 -0700
4Subject: [PATCH] telnet/telnetd: Fix print format strings
5
6Fixes build with hardening flags
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10Upstream-Status: Pending
11
12 telnet/utilities.cc | 6 +++---
13 telnetd/utility.c | 6 +++---
14 2 files changed, 6 insertions(+), 6 deletions(-)
15
16diff --git a/telnet/utilities.cc b/telnet/utilities.cc
17index 66839ab..36f0731 100644
18--- a/telnet/utilities.cc
19+++ b/telnet/utilities.cc
20@@ -583,17 +583,17 @@ void printsub(int direction, unsigned char *pointer, int length) {
21 case ENV_VAR:
22 if (pointer[1] == TELQUAL_SEND)
23 goto def_case;
24- fprintf(NetTrace, "\" VAR " + noquote);
25+ fprintf(NetTrace, "%s", "\" VAR " + noquote);
26 noquote = 2;
27 break;
28
29 case ENV_VALUE:
30- fprintf(NetTrace, "\" VALUE " + noquote);
31+ fprintf(NetTrace, "%s", "\" VALUE " + noquote);
32 noquote = 2;
33 break;
34
35 case ENV_ESC:
36- fprintf(NetTrace, "\" ESC " + noquote);
37+ fprintf(NetTrace, "%s", "\" ESC " + noquote);
38 noquote = 2;
39 break;
40
41diff --git a/telnetd/utility.c b/telnetd/utility.c
42index 29b7da1..75314cb 100644
43--- a/telnetd/utility.c
44+++ b/telnetd/utility.c
45@@ -909,17 +909,17 @@ printsub(char direction, unsigned char *pointer, int length)
46 case ENV_VAR:
47 if (pointer[1] == TELQUAL_SEND)
48 goto def_case;
49- netoprintf("\" VAR " + noquote);
50+ netoprintf("%s", "\" VAR " + noquote);
51 noquote = 2;
52 break;
53
54 case ENV_VALUE:
55- netoprintf("\" VALUE " + noquote);
56+ netoprintf("%s", "\" VALUE " + noquote);
57 noquote = 2;
58 break;
59
60 case ENV_ESC:
61- netoprintf("\" ESC " + noquote);
62+ netoprintf("%s", "\" ESC " + noquote);
63 noquote = 2;
64 break;
65
66--
672.13.2
68
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnetd-utility.c-Fix-buffer-overflow-in-netoprintf.patch b/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnetd-utility.c-Fix-buffer-overflow-in-netoprintf.patch
deleted file mode 100644
index 8f983e40ab..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/0001-telnetd-utility.c-Fix-buffer-overflow-in-netoprintf.patch
+++ /dev/null
@@ -1,56 +0,0 @@
1From 9c81c8e5bc7782e8ae12c078615abc3c896059f2 Mon Sep 17 00:00:00 2001
2From: Julius Hemanth Pitti <jpitti@cisco.com>
3Date: Tue, 14 Jul 2020 22:34:19 -0700
4Subject: [PATCH] telnetd/utility.c: Fix buffer overflow in netoprintf
5
6As per man page of vsnprintf, when formated
7string size is greater than "size"(2nd argument),
8then vsnprintf returns size of formated string,
9not "size"(2nd argument).
10
11netoprintf() was not handling a case where
12return value of vsnprintf is greater than
13"size"(2nd argument), results in buffer overflow
14while adjusting "nfrontp" pointer to point
15beyond "netobuf" buffer.
16
17Here is one such case where "nfrontp"
18crossed boundaries of "netobuf", and
19pointing to another global variable.
20
21(gdb) p &netobuf[8255]
22$5 = 0x55c93afe8b1f <netobuf+8255> ""
23(gdb) p nfrontp
24$6 = 0x55c93afe8c20 <terminaltype> "\377"
25(gdb) p &terminaltype
26$7 = (char **) 0x55c93afe8c20 <terminaltype>
27(gdb)
28
29This resulted in crash of telnetd service
30with segmentation fault.
31
32Though this is DoS security bug, I couldn't
33find any CVE ID for this.
34
35Upstream-Status: Pending
36
37Signed-off-by: Julius Hemanth Pitti <jpitti@cisco.com>
38---
39 telnetd/utility.c | 2 +-
40 1 file changed, 1 insertion(+), 1 deletion(-)
41
42diff --git a/telnetd/utility.c b/telnetd/utility.c
43index b9a46a6..4811f14 100644
44--- a/telnetd/utility.c
45+++ b/telnetd/utility.c
46@@ -66,7 +66,7 @@ netoprintf(const char *fmt, ...)
47 len = vsnprintf(nfrontp, maxsize, fmt, ap);
48 va_end(ap);
49
50- if (len<0 || len==maxsize) {
51+ if (len<0 || len>=maxsize) {
52 /* didn't fit */
53 netflush();
54 }
55--
562.19.1
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/0001-utility-Include-time.h-form-time-and-strftime-protot.patch b/meta-networking/recipes-netkit/netkit-telnet/files/0001-utility-Include-time.h-form-time-and-strftime-protot.patch
deleted file mode 100644
index a5e634caab..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/0001-utility-Include-time.h-form-time-and-strftime-protot.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 23b068e695881be0e8205ecccadf775fc3d5889d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 6 Sep 2022 21:25:50 -0700
4Subject: [PATCH] utility: Include time.h form time() and strftime() prototypes
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 telnetd/utility.c | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/telnetd/utility.c b/telnetd/utility.c
14index 4811f14..b539777 100644
15--- a/telnetd/utility.c
16+++ b/telnetd/utility.c
17@@ -40,6 +40,7 @@ char util_rcsid[] =
18 #define PRINTOPTIONS
19
20 #include <stdarg.h>
21+#include <time.h> /* for time() anf strftime() */
22 #include <sys/utsname.h>
23
24 #ifdef AUTHENTICATE
25--
262.37.3
27
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/CVE-2020-10188.patch b/meta-networking/recipes-netkit/netkit-telnet/files/CVE-2020-10188.patch
deleted file mode 100644
index d21c602746..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/CVE-2020-10188.patch
+++ /dev/null
@@ -1,112 +0,0 @@
1From 6ab007dbb1958371abff2eaaad2b26da89b3c74e Mon Sep 17 00:00:00 2001
2From: Yi Zhao <yi.zhao@windriver.com>
3Date: Fri, 24 Apr 2020 09:43:44 +0800
4Subject: [PATCH] telnetd/utility.c: fix CVE-2020-10188
5
6Upstream-Status: Backport
7[Fedora: https://src.fedoraproject.org/rpms/telnet/raw/master/f/telnet-0.17-overflow-exploit.patch]
8
9CVE: CVE-2020-10188
10
11Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
12---
13 telnetd/utility.c | 32 +++++++++++++++++++++-----------
14 1 file changed, 21 insertions(+), 11 deletions(-)
15
16diff --git a/telnetd/utility.c b/telnetd/utility.c
17index 75314cb..b9a46a6 100644
18--- a/telnetd/utility.c
19+++ b/telnetd/utility.c
20@@ -169,31 +169,38 @@ void ptyflush(void)
21 */
22 static
23 char *
24-nextitem(char *current)
25+nextitem(char *current, const char *endp)
26 {
27+ if (current >= endp) {
28+ return NULL;
29+ }
30 if ((*current&0xff) != IAC) {
31 return current+1;
32 }
33+ if (current+1 >= endp) {
34+ return NULL;
35+ }
36 switch (*(current+1)&0xff) {
37 case DO:
38 case DONT:
39 case WILL:
40 case WONT:
41- return current+3;
42+ return current+3 <= endp ? current+3 : NULL;
43 case SB: /* loop forever looking for the SE */
44 {
45 register char *look = current+2;
46
47- for (;;) {
48+ while (look < endp) {
49 if ((*look++&0xff) == IAC) {
50- if ((*look++&0xff) == SE) {
51+ if (look < endp && (*look++&0xff) == SE) {
52 return look;
53 }
54 }
55 }
56+ return NULL;
57 }
58 default:
59- return current+2;
60+ return current+2 <= endp ? current+2 : NULL;
61 }
62 } /* end of nextitem */
63
64@@ -219,7 +226,7 @@ void netclear(void)
65 register char *thisitem, *next;
66 char *good;
67 #define wewant(p) ((nfrontp > p) && ((*p&0xff) == IAC) && \
68- ((*(p+1)&0xff) != EC) && ((*(p+1)&0xff) != EL))
69+ (nfrontp > p+1 && (((*(p+1)&0xff) != EC) && ((*(p+1)&0xff) != EL))))
70
71 #if defined(ENCRYPT)
72 thisitem = nclearto > netobuf ? nclearto : netobuf;
73@@ -227,7 +234,7 @@ void netclear(void)
74 thisitem = netobuf;
75 #endif
76
77- while ((next = nextitem(thisitem)) <= nbackp) {
78+ while ((next = nextitem(thisitem, nbackp)) != NULL && next <= nbackp) {
79 thisitem = next;
80 }
81
82@@ -239,20 +246,23 @@ void netclear(void)
83 good = netobuf; /* where the good bytes go */
84 #endif
85
86- while (nfrontp > thisitem) {
87+ while (thisitem != NULL && nfrontp > thisitem) {
88 if (wewant(thisitem)) {
89 int length;
90
91 next = thisitem;
92 do {
93- next = nextitem(next);
94- } while (wewant(next) && (nfrontp > next));
95+ next = nextitem(next, nfrontp);
96+ } while (next != NULL && wewant(next) && (nfrontp > next));
97+ if (next == NULL) {
98+ next = nfrontp;
99+ }
100 length = next-thisitem;
101 bcopy(thisitem, good, length);
102 good += length;
103 thisitem = next;
104 } else {
105- thisitem = nextitem(thisitem);
106+ thisitem = nextitem(thisitem, nfrontp);
107 }
108 }
109
110--
1112.7.4
112
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/CVE-2022-39028.patch b/meta-networking/recipes-netkit/netkit-telnet/files/CVE-2022-39028.patch
deleted file mode 100644
index e8c3f1d84b..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/CVE-2022-39028.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From 4133a888aa256312186962ab70d4a36eed5920c1 Mon Sep 17 00:00:00 2001
2From: Brooks Davis <brooks@FreeBSD.org>
3Date: Mon, 26 Sep 2022 18:56:51 +0100
4Subject: [PATCH] telnetd: fix two-byte input crash
5
6Move initialization of the slc table earlier so it doesn't get
7accessed before that happens.
8
9For details on the issue, see:
10https://pierrekim.github.io/blog/2022-08-24-2-byte-dos-freebsd-netbsd-telnetd-netkit-telnetd-inetutils-telnetd-kerberos-telnetd.html
11
12Reviewed by: cy
13Obtained from: NetBSD via cy
14Differential Revision: https://reviews.freebsd.org/D36680
15
16CVE: CVE-2022-39028
17Upstream-Status: Backport [https://cgit.freebsd.org/src/commit/?id=6914ffef4e23]
18
19(cherry picked from commit 6914ffef4e2318ca1d0ead28eafb6f06055ce0f8)
20Signed-off-by: Sanjay Chitroda <sanjay.chitroda@einfochips.com>
21
22---
23 telnetd/telnetd.c | 10 +++++-----
24 1 file changed, 5 insertions(+), 5 deletions(-)
25
26diff --git a/telnetd/telnetd.c b/telnetd/telnetd.c
27index f36f505..efa0fe1 100644
28--- a/telnetd/telnetd.c
29+++ b/telnetd/telnetd.c
30@@ -615,6 +615,11 @@ doit(struct sockaddr_in *who)
31 int level;
32 char user_name[256];
33
34+ /*
35+ * Initialize the slc mapping table.
36+ */
37+ get_slc_defaults();
38+
39 /*
40 * Find an available pty to use.
41 */
42@@ -698,11 +703,6 @@ void telnet(int f, int p)
43 char *HE;
44 const char *IM;
45
46- /*
47- * Initialize the slc mapping table.
48- */
49- get_slc_defaults();
50-
51 /*
52 * Do some tests where it is desireable to wait for a response.
53 * Rather than doing them slowly, one at a time, do them all
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/To-aviod-buffer-overflow-in-telnet.patch b/meta-networking/recipes-netkit/netkit-telnet/files/To-aviod-buffer-overflow-in-telnet.patch
deleted file mode 100644
index 34a6479790..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/To-aviod-buffer-overflow-in-telnet.patch
+++ /dev/null
@@ -1,1217 +0,0 @@
1From f09a6460a62aacb87bb8683d16aa3ce55848bf7e Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Fri, 28 Nov 2014 07:06:24 +0900
4Subject: [PATCH 1/2] To aviod buffer overflow in telnet
5
6This patch is from Fedora.
7
8Upstream-Status: Pending
9
10Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
11---
12 telnet/Makefile | 4 +-
13 telnet/commands.cc | 270 +++++++++++++++++++++++++++++++++++-----------------
14 telnet/defines.h | 2 +
15 telnet/externs.h | 7 +-
16 telnet/main.cc | 65 ++++++++++---
17 telnet/netlink.cc | 78 +++++++++------
18 telnet/netlink.h | 7 +-
19 telnet/network.cc | 1 +
20 telnet/proto.h | 2 +-
21 telnet/ring.cc | 2 +-
22 telnet/ring.h | 2 +-
23 telnet/sys_bsd.cc | 11 +++
24 telnet/telnet.1 | 37 +++++--
25 telnet/telnet.cc | 45 +++++----
26 telnet/terminal.cc | 17 +++-
27 telnet/utilities.cc | 2 +
28 16 files changed, 380 insertions(+), 172 deletions(-)
29
30diff --git a/telnet/Makefile b/telnet/Makefile
31index cef866f..39249e1 100644
32--- a/telnet/Makefile
33+++ b/telnet/Makefile
34@@ -7,7 +7,7 @@ include ../MRULES
35
36 # -DAUTHENTICATE
37 CXXFLAGS += -DUSE_TERMIO -DKLUDGELINEMODE
38-LIBS += $(LIBTERMCAP)
39+LIBS = $(LIBTERMCAP)
40
41 SRCS = commands.cc main.cc network.cc ring.cc sys_bsd.cc telnet.cc \
42 terminal.cc tn3270.cc utilities.cc genget.cc environ.cc netlink.cc
43@@ -22,7 +22,7 @@ depend:
44 $(CXX) $(CXXFLAGS) -MM $(SRCS) >depend.mk
45
46 install: telnet
47- install -s -m$(BINMODE) telnet $(INSTALLROOT)$(BINDIR)
48+ install -m$(BINMODE) telnet $(INSTALLROOT)$(BINDIR)
49 install -m$(MANMODE) telnet.1 $(INSTALLROOT)$(MANDIR)/man1
50
51 clean:
52diff --git a/telnet/commands.cc b/telnet/commands.cc
53index d92bccd..02c593e 100644
54--- a/telnet/commands.cc
55+++ b/telnet/commands.cc
56@@ -86,10 +86,6 @@ char cmd_rcsid[] =
57
58 #define HELPINDENT ((int) sizeof ("connect"))
59
60-#ifndef MAXHOSTNAMELEN
61-#define MAXHOSTNAMELEN 64
62-#endif MAXHOSTNAMELEN
63-
64 #if defined(HAS_IPPROTO_IP) && defined(IP_TOS)
65 int tos = -1;
66 #endif /* defined(HAS_IPPROTO_IP) && defined(IP_TOS) */
67@@ -98,7 +94,7 @@ static unsigned long sourceroute(char *arg, char **cpp, int *lenp);
68
69
70 char *hostname;
71-static char _hostname[MAXHOSTNAMELEN];
72+static char *_hostname;
73
74 //typedef int (*intrtn_t)(int argc, const char *argv[]);
75
76@@ -161,7 +157,7 @@ class command_entry {
77 assert(argc>=1);
78 if (nargs>=0 && argc!=nargs+1) {
79 fprintf(stderr, "Wrong number of arguments for command.\n");
80- fprintf(stderr, "Try %s ? for help\n", argv[0]);
81+ fprintf(stderr, "Try ? %s for help\n", argv[0]);
82 return 0; /* is this right? */
83 }
84 if (nargs==-2) {
85@@ -480,6 +476,7 @@ static int send_wontcmd(const char *name, const char *) {
86 int send_tncmd(int (*func)(int, int), const char *cmd, const char *name) {
87 char **cpp;
88 extern char *telopts[];
89+ long opt;
90
91 if (isprefix(name, "help") || isprefix(name, "?")) {
92 register int col, len;
93@@ -506,16 +503,23 @@ int send_tncmd(int (*func)(int, int), const char *cmd, const char *name) {
94 name, cmd);
95 return 0;
96 }
97+
98+ opt = cpp - telopts;
99 if (cpp == 0) {
100- fprintf(stderr, "'%s': unknown argument ('send %s ?' for help).\n",
101+ char *end;
102+
103+ opt = strtol(name, &end, 10);
104+ if (*end || opt < 0 || opt > 255) {
105+ fprintf(stderr, "'%s': unknown argument ('send %s ?' for help).\n",
106 name, cmd);
107- return 0;
108+ return 0;
109+ }
110 }
111 if (!connected) {
112 printf("?Need to be connected first.\n");
113 return 0;
114 }
115- (*func)(cpp - telopts, 1);
116+ (*func)(opt, 1);
117 return 1;
118 }
119
120@@ -689,9 +693,9 @@ static struct togglelist Togglelist[] = {
121 "print encryption debugging information" },
122 #endif
123
124- { "skiprc", "don't read ~/.telnetrc file",
125+ { "skiprc", "don't read the telnetrc files",
126 NULL, &skiprc,
127- "read ~/.telnetrc file" },
128+ "read the telnetrc files" },
129 { "binary",
130 "sending and receiving of binary data",
131 togbinary, NULL,
132@@ -1615,15 +1619,20 @@ void ayt_status(int) {
133 #endif
134
135 int tn(int argc, const char *argv[]) {
136- register struct hostent *host = 0;
137 struct sockaddr_in sn;
138- struct servent *sp = 0;
139 char *srp = NULL;
140 int srlen;
141-
142- const char *cmd, *volatile user = 0;
143+ int family = 0;
144+ const char *cmd, *volatile user = 0, *srchostp = 0;
145 const char *portp = NULL;
146 char *hostp = NULL;
147+ char *resolv_hostp;
148+ struct addrinfo hints;
149+ struct addrinfo *hostaddr = 0;
150+ int res;
151+ char name[NI_MAXHOST];
152+ char service[NI_MAXSERV];
153+ struct addrinfo *tmpaddr;
154
155 /* clear the socket address prior to use */
156 memset(&sn, 0, sizeof(sn));
157@@ -1632,6 +1641,10 @@ int tn(int argc, const char *argv[]) {
158 printf("?Already connected to %s\n", hostname);
159 return 0;
160 }
161+ if (_hostname) {
162+ delete[] _hostname;
163+ _hostname = 0;
164+ }
165 if (argc < 2) {
166 (void) strcpy(line, "open ");
167 printf("(to) ");
168@@ -1657,11 +1670,33 @@ int tn(int argc, const char *argv[]) {
169 --argc;
170 continue;
171 }
172+ if (strcmp(*argv, "-b") == 0) {
173+ --argc; ++argv;
174+ if (argc == 0)
175+ goto usage;
176+ srchostp = *argv++;
177+ --argc;
178+ continue;
179+ }
180 if (strcmp(*argv, "-a") == 0) {
181 --argc; ++argv;
182 autologin = 1;
183 continue;
184 }
185+ if (strcmp(*argv, "-6") == 0) {
186+ --argc; ++argv;
187+#ifdef AF_INET6
188+ family = AF_INET6;
189+#else
190+ puts("IPv6 unsupported");
191+#endif
192+ continue;
193+ }
194+ if (strcmp(*argv, "-4") == 0) {
195+ --argc; ++argv;
196+ family = AF_INET;
197+ continue;
198+ }
199 if (hostp == 0) {
200 /* this leaks memory - FIXME */
201 hostp = strdup(*argv++);
202@@ -1680,6 +1715,8 @@ int tn(int argc, const char *argv[]) {
203 if (hostp == 0)
204 goto usage;
205
206+ resolv_hostp = hostp;
207+
208 #if defined(IP_OPTIONS) && defined(HAS_IPPROTO_IP)
209 if (hostp[0] == '@' || hostp[0] == '!') {
210 if ((hostname = strrchr(hostp, ':')) == NULL)
211@@ -1696,78 +1733,122 @@ int tn(int argc, const char *argv[]) {
212 } else {
213 sn.sin_addr.s_addr = temp;
214 sn.sin_family = AF_INET;
215+ /*
216+ * For source route we just make sure to get the IP given
217+ * on the command line when looking up the port.
218+ */
219+ resolv_hostp = inet_ntoa(sn.sin_addr);
220 }
221 }
222- else {
223-#endif
224- if (inet_aton(hostp, &sn.sin_addr)) {
225- sn.sin_family = AF_INET;
226- strcpy(_hostname, hostp);
227- hostname = _hostname;
228- }
229- else {
230- host = gethostbyname(hostp);
231- if (host) {
232- sn.sin_family = host->h_addrtype;
233- if (host->h_length > (int)sizeof(sn.sin_addr)) {
234- host->h_length = sizeof(sn.sin_addr);
235- }
236-#if defined(h_addr) /* In 4.3, this is a #define */
237- memcpy((caddr_t)&sn.sin_addr,
238- host->h_addr_list[0], host->h_length);
239-#else /* defined(h_addr) */
240- memcpy((caddr_t)&sn.sin_addr, host->h_addr, host->h_length);
241-#endif /* defined(h_addr) */
242- strncpy(_hostname, host->h_name, sizeof(_hostname));
243- _hostname[sizeof(_hostname)-1] = '\0';
244- hostname = _hostname;
245- } else {
246- herror(hostp);
247- return 0;
248- }
249- }
250-#if defined(IP_OPTIONS) && defined(HAS_IPPROTO_IP)
251- }
252 #endif
253+
254+ /* User port or the default name of telnet. */
255 if (portp) {
256 if (*portp == '-') {
257 portp++;
258 telnetport = 1;
259- } else
260+ } else {
261 telnetport = 0;
262- sn.sin_port = atoi(portp);
263- if (sn.sin_port == 0) {
264- sp = getservbyname(portp, "tcp");
265- if (sp)
266- sn.sin_port = sp->s_port;
267- else {
268- printf("%s: bad port number\n", portp);
269- return 0;
270+ if (*portp >='0' && *portp<='9') {
271+ char *end;
272+ long int p;
273+
274+ p=strtol(portp, &end, 10);
275+ if (ERANGE==errno && (LONG_MIN==p || LONG_MAX==p)) {
276+ fprintf(stderr, "telnet: port %s overflows\n", portp);
277+ return 0;
278+ } else if (p<=0 || p>=65536) {
279+ fprintf(stderr, "telnet: port %s out of range\n", portp);
280+ return 0;
281+ }
282 }
283- }
284- else {
285- sn.sin_port = htons(sn.sin_port);
286 }
287- }
288+ }
289 else {
290- if (sp == 0) {
291- sp = getservbyname("telnet", "tcp");
292- if (sp == 0) {
293- fprintf(stderr, "telnet: tcp/telnet: unknown service\n");
294- return 0;
295- }
296- sn.sin_port = sp->s_port;
297- }
298+ portp = "telnet";
299 telnetport = 1;
300 }
301- printf("Trying %s...\n", inet_ntoa(sn.sin_addr));
302+
303+ /* We only understand SOCK_STREAM sockets. */
304+ memset(&hints, 0, sizeof(hints));
305+ hints.ai_socktype = SOCK_STREAM;
306+ hints.ai_flags = AI_NUMERICHOST;
307+ hints.ai_family = family;
308+
309+ if (srchostp) {
310+ res = getaddrinfo(srchostp, "0", &hints, &hostaddr);
311+ if (res) {
312+ fprintf(stderr, "telnet: could not resolve %s: %s\n", srchostp,
313+ gai_strerror(res));
314+ return 0;
315+ }
316+ hints.ai_family = hostaddr->ai_family;
317+ res = nlink.bind(hostaddr);
318+ freeaddrinfo(hostaddr);
319+ if (res < 0)
320+ return 0;
321+ }
322+
323+ /* Resolve both the host and service simultaneously. */
324+ res = getaddrinfo(resolv_hostp, portp, &hints, &hostaddr);
325+ if (res == EAI_NONAME) {
326+ hints.ai_flags = AI_CANONNAME;
327+ res = getaddrinfo(resolv_hostp, portp, &hints, &hostaddr);
328+ } else if (hostaddr) {
329+ hostaddr->ai_canonname = 0;
330+ }
331+ if (res || !hostaddr) {
332+ fprintf(stderr, "telnet: could not resolve %s/%s: %s\n", resolv_hostp, portp, gai_strerror(res));
333+ return 0;
334+ }
335+
336+ /* Try to connect to every listed round robin IP. */
337+ tmpaddr = hostaddr;
338+ errno = 0;
339 do {
340- int x = nlink.connect(debug, host, &sn, srp, srlen, tos);
341- if (!x) return 0;
342- else if (x==1) continue;
343+ int x;
344+
345+ if (!tmpaddr) {
346+ if (errno)
347+ perror("telnet: Unable to connect to remote host");
348+ else
349+ fputs("telnet: Unable to connect to remote host: "
350+ "Bad port number\n", stderr);
351+err:
352+ freeaddrinfo(hostaddr);
353+ return 0;
354+ }
355+
356+ if (tmpaddr->ai_family == AF_UNIX) {
357+nextaddr:
358+ tmpaddr = tmpaddr->ai_next;
359+ continue;
360+ }
361+
362+ getnameinfo(tmpaddr->ai_addr, tmpaddr->ai_addrlen,
363+ name, sizeof(name), service, sizeof(service),
364+ NI_NUMERICHOST | NI_NUMERICSERV);
365+
366+ printf("Trying %s...\n", name);
367+ x = nlink.connect(debug, tmpaddr, srp, srlen, tos);
368+ if (!x)
369+ goto err;
370+ else if (x==1)
371+ goto nextaddr;
372+
373 connected++;
374 } while (connected == 0);
375- cmdrc(hostp, hostname);
376+ if (tmpaddr->ai_canonname == 0) {
377+ hostname = new char[strlen(hostp)+1];
378+ strcpy(hostname, hostp);
379+ }
380+ else {
381+ hostname = new char[strlen(tmpaddr->ai_canonname)+1];
382+ strcpy(hostname, tmpaddr->ai_canonname);
383+ }
384+
385+ cmdrc(hostp, hostname, portp);
386+ freeaddrinfo(hostaddr);
387 if (autologin && user == NULL) {
388 struct passwd *pw;
389
390@@ -2013,30 +2094,21 @@ static int help(command_table *tab, int argc, const char *argv[]) {
391 return 0;
392 }
393
394-static char *rcname = 0;
395-static char rcbuf[128];
396-
397-void cmdrc(const char *m1, const char *m2) {
398+static void readrc(const char *m1, const char *m2, const char *port,
399+ const char *rcname)
400+{
401 FILE *rcfile;
402 int gotmachine = 0;
403 int l1 = strlen(m1);
404 int l2 = strlen(m2);
405- char m1save[64];
406-
407- if (skiprc) return;
408+ int lport = strlen(port);
409+ char m1save[l1 + 1];
410+ char portsave[lport + 1];
411
412 strcpy(m1save, m1);
413 m1 = m1save;
414-
415- if (rcname == 0) {
416- rcname = getenv("HOME");
417- if (rcname)
418- strcpy(rcbuf, rcname);
419- else
420- rcbuf[0] = '\0';
421- strcat(rcbuf, "/.telnetrc");
422- rcname = rcbuf;
423- }
424+ strcpy(portsave, port);
425+ port = portsave;
426
427 rcfile = fopen(rcname, "r");
428 if (!rcfile) return;
429@@ -2061,6 +2133,13 @@ void cmdrc(const char *m1, const char *m2) {
430 strncpy(line, &line[7], sizeof(line) - 7);
431 else
432 continue;
433+
434+ if (line[0] == ':') {
435+ if (!strncasecmp(&line[1], port, lport))
436+ continue;
437+ strncpy(line, &line[lport + 1], sizeof(line) - lport - 1);
438+ }
439+
440 if (line[0] != ' ' && line[0] != '\t' && line[0] != '\n')
441 continue;
442 gotmachine = 1;
443@@ -2073,6 +2152,21 @@ void cmdrc(const char *m1, const char *m2) {
444 fclose(rcfile);
445 }
446
447+void cmdrc(const char *m1, const char *m2, const char *port) {
448+ char *rcname = NULL;
449+
450+ if (skiprc) return;
451+
452+ readrc(m1, m2, port, "/etc/telnetrc");
453+ if (asprintf (&rcname, "%s/.telnetrc", getenv ("HOME")) == -1)
454+ {
455+ perror ("asprintf");
456+ return;
457+ }
458+ readrc(m1, m2, port, rcname);
459+ free (rcname);
460+}
461+
462 #if defined(IP_OPTIONS) && defined(HAS_IPPROTO_IP)
463
464 /*
465diff --git a/telnet/defines.h b/telnet/defines.h
466index 2784400..d5edc46 100644
467--- a/telnet/defines.h
468+++ b/telnet/defines.h
469@@ -50,3 +50,5 @@
470 #define MODE_COMMAND_LINE(m) ((m)==-1)
471
472 #define CONTROL(x) ((x)&0x1f) /* CTRL(x) is not portable */
473+
474+#define MODE_OUT8 0x8000 /* binary mode sans -opost */
475diff --git a/telnet/externs.h b/telnet/externs.h
476index 955df79..0730e8a 100644
477--- a/telnet/externs.h
478+++ b/telnet/externs.h
479@@ -48,9 +48,7 @@
480 typedef unsigned char cc_t;
481 #endif
482
483-#ifdef __linux__
484 #include <unistd.h> /* get _POSIX_VDISABLE */
485-#endif
486
487 #ifndef _POSIX_VDISABLE
488 #error "Please fix externs.h to define _POSIX_VDISABLE"
489@@ -60,7 +58,8 @@ typedef unsigned char cc_t;
490
491 extern int autologin; /* Autologin enabled */
492 extern int skiprc; /* Don't process the ~/.telnetrc file */
493-extern int eight; /* use eight bit mode (binary in and/or out */
494+extern int eight; /* use eight bit mode (binary in and/or out) */
495+extern int binary; /* use binary option (in and/or out) */
496 extern int flushout; /* flush output */
497 extern int connected; /* Are we connected to the other side? */
498 extern int globalmode; /* Mode tty should be in */
499@@ -225,6 +224,8 @@ cc_t *tcval(int);
500
501 //#if 0
502 extern struct termios new_tc;
503+extern struct termios old_tc;
504+
505
506 #define termEofChar new_tc.c_cc[VEOF]
507 #define termEraseChar new_tc.c_cc[VERASE]
508diff --git a/telnet/main.cc b/telnet/main.cc
509index b67f2ce..b626e54 100644
510--- a/telnet/main.cc
511+++ b/telnet/main.cc
512@@ -45,7 +45,10 @@ char main_rcsid[] =
513
514 #include <sys/types.h>
515 #include <getopt.h>
516+#include <stdlib.h>
517 #include <string.h>
518+#include <netdb.h>
519+#include <errno.h>
520
521 #include "ring.h"
522 #include "externs.h"
523@@ -80,12 +83,13 @@ tninit(void)
524 void usage(void) {
525 fprintf(stderr, "Usage: %s %s%s%s%s\n",
526 prompt,
527- " [-8] [-E] [-L] [-a] [-d] [-e char] [-l user] [-n tracefile]",
528- "\n\t",
529+ "[-4] [-6] [-8] [-E] [-L] [-a] [-d] [-e char] [-l user]",
530+ "\n\t[-n tracefile] [ -b addr ]",
531 #ifdef TN3270
532+ "\n\t"
533 "[-noasynch] [-noasynctty] [-noasyncnet] [-r] [-t transcom]\n\t",
534 #else
535- "[-r] ",
536+ " [-r] ",
537 #endif
538 "[host-name [port]]"
539 );
540@@ -102,7 +106,8 @@ main(int argc, char *argv[])
541 extern char *optarg;
542 extern int optind;
543 int ch;
544- char *user;
545+ char *user, *srcaddr;
546+ int family;
547
548 tninit(); /* Clear out things */
549 #if defined(CRAY) && !defined(__STDC__)
550@@ -110,21 +115,38 @@ main(int argc, char *argv[])
551 #endif
552
553 TerminalSaveState();
554+ if ((old_tc.c_cflag & (CSIZE|PARENB)) != CS8)
555+ eight = 0;
556
557 if ((prompt = strrchr(argv[0], '/'))!=NULL)
558 ++prompt;
559 else
560 prompt = argv[0];
561
562- user = NULL;
563+ user = srcaddr = NULL;
564+ family = 0;
565
566 rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE;
567 autologin = -1;
568
569- while ((ch = getopt(argc, argv, "8EKLS:X:ade:k:l:n:rt:x")) != EOF) {
570+ while ((ch = getopt(argc, argv,
571+ "4678EKLS:X:ab:de:k:l:n:rt:x")) != EOF) {
572 switch(ch) {
573+ case '4':
574+ family = AF_INET;
575+ break;
576+ case '6':
577+#ifdef AF_INET6
578+ family = AF_INET6;
579+#else
580+ fputs("IPv6 unsupported\n", stderr);
581+#endif
582+ break;
583+ case '7':
584+ eight = 0; /* 7-bit ouput and input */
585+ break;
586 case '8':
587- eight = 3; /* binary output and input */
588+ binary = 3; /* binary output and input */
589 break;
590 case 'E':
591 rlogin = escapechar = _POSIX_VDISABLE;
592@@ -133,23 +155,26 @@ main(int argc, char *argv[])
593 //autologin = 0;
594 break;
595 case 'L':
596- eight |= 2; /* binary output only */
597+ binary |= 2; /* binary output only */
598 break;
599 case 'S':
600 {
601-#ifdef HAS_GETTOS
602 extern int tos;
603+ int num;
604
605- if ((tos = parsetos(optarg, "tcp")) < 0)
606+#ifdef HAS_GETTOS
607+ if ((num = parsetos(optarg, "tcp")) < 0) {
608+#else
609+ errno = 0;
610+ num = strtol(optarg, 0, 0);
611+ if (errno) {
612+#endif
613 fprintf(stderr, "%s%s%s%s\n",
614 prompt, ": Bad TOS argument '",
615 optarg,
616 "; will try to use default TOS");
617-#else
618- fprintf(stderr,
619- "%s: Warning: -S ignored, no parsetos() support.\n",
620- prompt);
621-#endif
622+ } else
623+ tos = num;
624 }
625 break;
626 case 'X':
627@@ -210,6 +235,9 @@ main(int argc, char *argv[])
628 "%s: -x ignored, no encryption support.\n",
629 prompt);
630 break;
631+ case 'b':
632+ srcaddr = optarg;
633+ break;
634 case '?':
635 default:
636 usage();
637@@ -233,6 +261,13 @@ main(int argc, char *argv[])
638 *argp++ = "-l";
639 *argp++ = user;
640 }
641+ if (srcaddr) {
642+ *argp++ = "-b";
643+ *argp++ = srcaddr;
644+ }
645+ if (family) {
646+ *argp++ = family == AF_INET ? "-4" : "-6";
647+ }
648 *argp++ = argv[0]; /* host */
649 if (argc > 1)
650 *argp++ = argv[1]; /* port */
651diff --git a/telnet/netlink.cc b/telnet/netlink.cc
652index f439cff..f839747 100644
653--- a/telnet/netlink.cc
654+++ b/telnet/netlink.cc
655@@ -79,22 +79,61 @@ void netlink::close(int doshutdown) {
656 shutdown(net, 2);
657 }
658 ::close(net);
659+ net = -1;
660 }
661
662-int netlink::connect(int debug, struct hostent *host,
663- struct sockaddr_in *sn,
664- char *srcroute, int srlen, int tos)
665+int netlink::bind(struct addrinfo *addr)
666 {
667- int on=1;
668+ int res;
669+
670+ res = socket(addr->ai_family);
671+ if (res < 2) {
672+ if (res == 1)
673+ perror("telnet: socket");
674+ return -1;
675+ }
676+
677+ if (::bind(net, addr->ai_addr, addr->ai_addrlen) < 0) {
678+ perror("telnet: bind");
679+ return -1;
680+ }
681+
682+ return 0;
683+}
684+
685+int netlink::socket(int family)
686+{
687+ if (this->family != family)
688+ close(0);
689
690- net = socket(AF_INET, SOCK_STREAM, 0);
691 if (net < 0) {
692- perror("telnet: socket");
693- return 0;
694+ this->family = family;
695+ net = ::socket(family, SOCK_STREAM, 0);
696+ if (net < 0) {
697+ if (errno == EAFNOSUPPORT)
698+ return 1;
699+ perror("telnet: socket");
700+ return 0;
701+ }
702 }
703
704+ return 2;
705+}
706+
707+int netlink::connect(int debug, struct addrinfo *addr,
708+ char *srcroute, int srlen, int tos)
709+{
710+ int on=1;
711+ int res;
712+
713+ res = socket(addr->ai_family);
714+ if (res < 2)
715+ return res;
716+
717 #if defined(IP_OPTIONS) && defined(HAS_IPPROTO_IP)
718 if (srcroute) {
719+ if (addr->ai_family != AF_INET)
720+ fputs("Source route is only supported for IPv4\n", stderr);
721 if (setsockopt(net, IPPROTO_IP, IP_OPTIONS, srcroute, srlen) < 0)
722 perror("setsockopt (IP_OPTIONS)");
723 }
724@@ -108,7 +147,7 @@ int netlink::connect(int debug, struct hostent *host,
725 #endif
726 if (tos < 0) tos = 020; /* Low Delay bit */
727 if (tos && (setsockopt(net, IPPROTO_IP, IP_TOS, &tos, sizeof(int)) < 0)
728- && (errno != ENOPROTOOPT))
729+ && (errno != ENOPROTOOPT) && (errno != EOPNOTSUPP))
730 perror("telnet: setsockopt (IP_TOS) (ignored)");
731 #endif /* defined(IPPROTO_IP) && defined(IP_TOS) */
732
733@@ -116,27 +155,8 @@ int netlink::connect(int debug, struct hostent *host,
734 perror("setsockopt (SO_DEBUG)");
735 }
736
737- if (::connect(net, (struct sockaddr *)sn, sizeof(*sn)) < 0) {
738-#if defined(h_addr) /* In 4.3, this is a #define */
739- if (host && host->h_addr_list[1]) {
740- int oerrno = errno;
741-
742- fprintf(stderr, "telnet: connect to address %s: ",
743- inet_ntoa(sn->sin_addr));
744- errno = oerrno;
745- perror(NULL);
746- host->h_addr_list++;
747- if (host->h_length > (int)sizeof(sn->sin_addr)) {
748- host->h_length = sizeof(sn->sin_addr);
749- }
750- memcpy(&sn->sin_addr, host->h_addr_list[0], host->h_length);
751- close(net);
752- return 1;
753- }
754-#endif /* defined(h_addr) */
755-
756- perror("telnet: Unable to connect to remote host");
757- return 0;
758+ if (::connect(net, addr->ai_addr, addr->ai_addrlen) < 0) {
759+ return 1;
760 }
761 return 2;
762 }
763diff --git a/telnet/netlink.h b/telnet/netlink.h
764index 9852b30..0ac8a08 100644
765--- a/telnet/netlink.h
766+++ b/telnet/netlink.h
767@@ -1,13 +1,16 @@
768
769 class netlink {
770+ private:
771+ int family;
772 protected:
773 int net;
774 public:
775 netlink();
776 ~netlink();
777
778- int connect(int debug, struct hostent *host,
779- struct sockaddr_in *sin,
780+ int bind(struct addrinfo *hostaddr);
781+ int socket(int family);
782+ int connect(int debug, struct addrinfo *hostaddr,
783 char *srcroute, int srlen,
784 int tos);
785 void close(int doshutdown);
786diff --git a/telnet/network.cc b/telnet/network.cc
787index 6a2c374..0dcf3e2 100644
788--- a/telnet/network.cc
789+++ b/telnet/network.cc
790@@ -40,6 +40,7 @@ char net_rcsid[] =
791 #include <sys/types.h>
792 #include <sys/socket.h>
793 #include <sys/time.h>
794+#include <stdlib.h>
795 #include <errno.h>
796 #include <arpa/telnet.h>
797
798diff --git a/telnet/proto.h b/telnet/proto.h
799index 8be4a39..92f2419 100644
800--- a/telnet/proto.h
801+++ b/telnet/proto.h
802@@ -13,7 +13,7 @@ int TerminalWindowSize(long *rows, long *cols);
803 void auth_encrypt_user(char *);
804 void auth_name(unsigned char *, int);
805 void auth_printsub(unsigned char *, int, unsigned char *, int);
806-void cmdrc(const char *m1, const char *m2);
807+void cmdrc(const char *, const char *, const char *);
808 void env_init(void);
809 int getconnmode(void);
810 void init_network(void);
811diff --git a/telnet/ring.cc b/telnet/ring.cc
812index be57396..772c6c5 100644
813--- a/telnet/ring.cc
814+++ b/telnet/ring.cc
815@@ -165,7 +165,7 @@ int ringbuf::flush() {
816
817 /////////////////////////////////////////////////// supply //////////////
818
819-void ringbuf::printf(const char *format, ...) {
820+void ringbuf::xprintf(const char *format, ...) {
821 char xbuf[256];
822 va_list ap;
823 va_start(ap, format);
824diff --git a/telnet/ring.h b/telnet/ring.h
825index 15d3f3f..049377e 100644
826--- a/telnet/ring.h
827+++ b/telnet/ring.h
828@@ -83,7 +83,7 @@ class ringbuf {
829 // manual supply
830 void putch(char c) { write(&c, 1); }
831 void write(const char *buffer, int ct);
832- void printf(const char *format, ...);
833+ void xprintf(const char *format, ...);
834 int empty_count() { return size - count; }
835
836 // automatic supply
837diff --git a/telnet/sys_bsd.cc b/telnet/sys_bsd.cc
838index 93fba7e..a8c9aab 100644
839--- a/telnet/sys_bsd.cc
840+++ b/telnet/sys_bsd.cc
841@@ -189,18 +189,25 @@ void NetSetPgrp(int fd) {
842 * Various signal handling routines.
843 */
844
845+#if 0
846 static void deadpeer(int /*sig*/) {
847 setcommandmode();
848 siglongjmp(peerdied, -1);
849 }
850+#endif
851
852 static void intr(int /*sig*/) {
853 if (localchars) {
854 intp();
855 }
856 else {
857+#if 0
858 setcommandmode();
859 siglongjmp(toplevel, -1);
860+#else
861+ signal(SIGINT, SIG_DFL);
862+ raise(SIGINT);
863+#endif
864 }
865 }
866
867@@ -214,6 +221,8 @@ static void intr2(int /*sig*/) {
868 sendabort();
869 return;
870 }
871+ signal(SIGQUIT, SIG_DFL);
872+ raise(SIGQUIT);
873 }
874
875 #ifdef SIGWINCH
876@@ -238,7 +247,9 @@ void ayt(int sig) {
877 void sys_telnet_init(void) {
878 signal(SIGINT, intr);
879 signal(SIGQUIT, intr2);
880+#if 0
881 signal(SIGPIPE, deadpeer);
882+#endif
883 #ifdef SIGWINCH
884 signal(SIGWINCH, sendwin);
885 #endif
886diff --git a/telnet/telnet.1 b/telnet/telnet.1
887index 54a47fb..8365e42 100644
888--- a/telnet/telnet.1
889+++ b/telnet/telnet.1
890@@ -42,8 +42,9 @@
891 protocol
892 .Sh SYNOPSIS
893 .Nm telnet
894-.Op Fl 8ELadr
895+.Op Fl 468ELadr
896 .Op Fl S Ar tos
897+.Op Fl b Ar address
898 .Op Fl e Ar escapechar
899 .Op Fl l Ar user
900 .Op Fl n Ar tracefile
901@@ -68,6 +69,10 @@ command implicitly; see the description below.
902 .Pp
903 Options:
904 .Bl -tag -width indent
905+.It Fl 4
906+Force IPv4 address resolution.
907+.It Fl 6
908+Force IPv6 address resolution.
909 .It Fl 8
910 Request 8-bit operation. This causes an attempt to negotiate the
911 .Dv TELNET BINARY
912@@ -89,6 +94,8 @@ of the
913 option if supported by the remote system. The username is retrieved
914 via
915 .Xr getlogin 3 .
916+.It Fl b Ar address
917+Use bind(2) on the local socket to bind it to a specific local address.
918 .It Fl d
919 Sets the initial value of the
920 .Ic debug
921@@ -474,17 +481,29 @@ protocol without making a mess. Protocol negotiation can be forced by
922 placing a dash before the port number.
923 .Pp
924 After establishing a connection, any commands associated with the
925-remote host in the user's
926+remote host in
927+.Pa /etc/telnetrc
928+and the user's
929 .Pa .telnetrc
930-file are executed.
931+file are executed, in that order.
932 .Pp
933-The format of the .telnetrc file is as follows: Lines beginning with a
934+The format of the telnetrc files is as follows: Lines beginning with a
935 #, and blank lines, are ignored. The rest of the file should consist
936 of hostnames and sequences of
937 .Nm telnet
938 commands to use with that host. Commands should be one per line,
939 indented by whitespace; lines beginning without whitespace are
940-interpreted as hostnames. Upon connecting to a particular host, the
941+interpreted as hostnames. Lines beginning with the special hostname
942+.Ql DEFAULT
943+will apply to all hosts. Hostnames including
944+.Ql DEFAULT
945+may be followed immediately by a colon and a port number or string.
946+If a port is specified it must match exactly with what is specified
947+on the command line. If no port was specified on the command line,
948+then the value
949+.Ql telnet
950+is used.
951+Upon connecting to a particular host, the
952 commands associated with that host are executed.
953 .It Ic quit
954 Close any open session and exit
955@@ -1184,9 +1203,7 @@ escape sequences are preceded by a '*' to aid in locating them.
956 When the skiprc toggle is
957 .Dv TRUE ,
958 .Tn telnet
959-does not read the
960-.Pa \&.telnetrc
961-file. The initial value for this toggle is
962+does not read the telnetrc files. The initial value for this toggle is
963 .Dv FALSE.
964 .It Ic termdata
965 Toggles the display of all terminal data (in hexadecimal format).
966@@ -1239,7 +1256,9 @@ to the other side via the
967 .Dv TELNET ENVIRON
968 option.
969 .Sh FILES
970-.Bl -tag -width ~/.telnetrc -compact
971+.Bl -tag -width /etc/telnetrc -compact
972+.It Pa /etc/telnetrc
973+global telnet startup values
974 .It Pa ~/.telnetrc
975 user customized telnet startup values
976 .El
977diff --git a/telnet/telnet.cc b/telnet/telnet.cc
978index 4fc3b1f..7eca811 100644
979--- a/telnet/telnet.cc
980+++ b/telnet/telnet.cc
981@@ -88,7 +88,8 @@ char do_dont_resp[256];
982 char will_wont_resp[256];
983
984 int
985-eight = 0,
986+ eight = 3,
987+ binary = 0,
988 autologin = 0, /* Autologin anyone? */
989 skiprc = 0,
990 connected,
991@@ -639,14 +640,14 @@ static const char *gettermname(void) {
992 if (resettermname) {
993 resettermname = 0;
994 tname = env_getvalue("TERM", 0);
995- if (!tname || my_setupterm(tname, 1, &err)) {
996+ if (!tname /* || my_setupterm(tname, 1, &err) */) {
997 termbuf[0] = 0;
998 tname = "UNKNOWN";
999 }
1000 mklist(termbuf, tname, termtypes);
1001 next = 0;
1002 }
1003- if (next==termtypes.num()) next = 0;
1004+ if (next==termtypes.num()-1) next = 0;
1005 return termtypes[next++];
1006 }
1007 /*
1008@@ -681,7 +682,7 @@ static void suboption(void) {
1009 }
1010 #endif /* TN3270 */
1011 name = gettermname();
1012- netoring.printf("%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE,
1013+ netoring.xprintf("%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE,
1014 TELQUAL_IS, name, IAC, SE);
1015 }
1016 break;
1017@@ -693,7 +694,7 @@ static void suboption(void) {
1018 if (SB_GET() == TELQUAL_SEND) {
1019 long oospeed, iispeed;
1020 TerminalSpeeds(&iispeed, &oospeed);
1021- netoring.printf("%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED,
1022+ netoring.xprintf("%c%c%c%c%ld,%ld%c%c", IAC, SB, TELOPT_TSPEED,
1023 TELQUAL_IS, oospeed, iispeed, IAC, SE);
1024 }
1025 break;
1026@@ -780,7 +781,7 @@ static void suboption(void) {
1027 send_wont(TELOPT_XDISPLOC, 1);
1028 break;
1029 }
1030- netoring.printf("%c%c%c%c%s%c%c", IAC, SB, TELOPT_XDISPLOC,
1031+ netoring.xprintf("%c%c%c%c%s%c%c", IAC, SB, TELOPT_XDISPLOC,
1032 TELQUAL_IS, dp, IAC, SE);
1033 }
1034 break;
1035@@ -798,7 +799,7 @@ void lm_will(unsigned char *cmd, int len) {
1036 return;
1037 }
1038
1039- netoring.printf("%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1040+ netoring.xprintf("%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1041 DONT, cmd[0], IAC, SE);
1042 }
1043
1044@@ -815,7 +816,7 @@ void lm_do(unsigned char *cmd, int len) {
1045 /*@*/ printf("lm_do: no command!!!\n"); /* Should not happen... */
1046 return;
1047 }
1048- netoring.printf("%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1049+ netoring.xprintf("%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1050 WONT, cmd[0], IAC, SE);
1051 }
1052
1053@@ -838,7 +839,7 @@ void lm_mode(unsigned char *cmd, int len, int init) {
1054 k |= MODE_ACK;
1055 }
1056
1057- netoring.printf("%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE, LM_MODE,
1058+ netoring.xprintf("%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE, LM_MODE,
1059 k, IAC, SE);
1060
1061 setconnmode(0); /* set changed mode */
1062@@ -933,11 +934,11 @@ void slc_mode_import(int def) {
1063
1064 void slc_import(int def) {
1065 if (def) {
1066- netoring.printf("%c%c%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1067+ netoring.xprintf("%c%c%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1068 LM_SLC, 0, SLC_DEFAULT, 0, IAC, SE);
1069 }
1070 else {
1071- netoring.printf("%c%c%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1072+ netoring.xprintf("%c%c%c%c%c%c%c%c%c", IAC, SB, TELOPT_LINEMODE,
1073 LM_SLC, 0, SLC_VARIABLE, 0, IAC, SE);
1074 }
1075 }
1076@@ -1050,6 +1051,7 @@ void slc_check(void) {
1077
1078
1079 unsigned char slc_reply[128];
1080+unsigned char const * const slc_reply_eom = &slc_reply[sizeof(slc_reply)];
1081 unsigned char *slc_replyp;
1082
1083 void slc_start_reply(void) {
1084@@ -1061,6 +1063,14 @@ void slc_start_reply(void) {
1085 }
1086
1087 void slc_add_reply(int func, int flags, int value) {
1088+ /* A sequence of up to 6 bytes my be written for this member of the SLC
1089+ * suboption list by this function. The end of negotiation command,
1090+ * which is written by slc_end_reply(), will require 2 additional
1091+ * bytes. Do not proceed unless there is sufficient space for these
1092+ * items.
1093+ */
1094+ if (&slc_replyp[6+2] > slc_reply_eom)
1095+ return;
1096 if ((*slc_replyp++ = func) == IAC)
1097 *slc_replyp++ = IAC;
1098 if ((*slc_replyp++ = flags) == IAC)
1099@@ -1142,6 +1152,7 @@ void env_opt(unsigned char *buf, int len) {
1100 }
1101 }
1102
1103+/* OPT_REPLY_SIZE must be a multiple of 2. */
1104 #define OPT_REPLY_SIZE 256
1105 unsigned char *opt_reply;
1106 unsigned char *opt_replyp;
1107@@ -1173,6 +1184,7 @@ void env_opt_start_info(void) {
1108
1109 void env_opt_add(const char *ep) {
1110 const char *vp;
1111+ const unsigned char *tp;
1112 unsigned char c;
1113
1114 if (opt_reply == NULL) /*XXX*/
1115@@ -1185,11 +1197,12 @@ void env_opt_add(const char *ep) {
1116 return;
1117 }
1118 vp = env_getvalue(ep, 1);
1119- if (opt_replyp + (vp ? strlen(vp) : 0) + strlen(ep) + 6 > opt_replyend)
1120+ tp = opt_replyp + (vp ? strlen(vp) * 2 : 0) + strlen(ep) * 2 + 6;
1121+ if (tp > opt_replyend)
1122 {
1123 register int len;
1124- opt_replyend += OPT_REPLY_SIZE;
1125- len = opt_replyend - opt_reply;
1126+ len = ((tp - opt_reply) + OPT_REPLY_SIZE - 1) & ~(OPT_REPLY_SIZE - 1);
1127+ opt_replyend = opt_reply + len;
1128 opt_reply = (unsigned char *)realloc(opt_reply, len);
1129 if (opt_reply == NULL) {
1130 /*@*/ printf("env_opt_add: realloc() failed!!!\n");
1131@@ -1740,8 +1753,8 @@ void telnet(const char * /*user*/) {
1132 send_do(TELOPT_STATUS, 1);
1133 if (env_getvalue("DISPLAY", 0))
1134 send_will(TELOPT_XDISPLOC, 1);
1135- if (eight)
1136- tel_enter_binary(eight);
1137+ if (binary)
1138+ tel_enter_binary(binary);
1139 }
1140 #endif /* !defined(TN3270) */
1141
1142diff --git a/telnet/terminal.cc b/telnet/terminal.cc
1143index 9eb47ae..764f18f 100644
1144--- a/telnet/terminal.cc
1145+++ b/telnet/terminal.cc
1146@@ -45,6 +45,8 @@ char terminal_rcsid[] =
1147 #include <signal.h>
1148 #include <errno.h>
1149 #include <stdio.h>
1150+#include <string.h>
1151+#include <stdlib.h>
1152
1153 #include "ring.h"
1154 #include "defines.h"
1155@@ -155,9 +157,11 @@ int getconnmode(void) {
1156 if (localflow)
1157 mode |= MODE_FLOW;
1158
1159- if (my_want_state_is_will(TELOPT_BINARY))
1160+ if ((eight & 1) || my_want_state_is_will(TELOPT_BINARY))
1161 mode |= MODE_INBIN;
1162
1163+ if (eight & 2)
1164+ mode |= MODE_OUT8;
1165 if (his_want_state_is_will(TELOPT_BINARY))
1166 mode |= MODE_OUTBIN;
1167
1168@@ -449,10 +453,13 @@ void TerminalNewMode(int f)
1169 // breaks SunOS.
1170 tmp_tc.c_iflag |= ISTRIP;
1171 }
1172- if (f & MODE_OUTBIN) {
1173+ if (f & (MODE_OUTBIN|MODE_OUT8)) {
1174 tmp_tc.c_cflag &= ~(CSIZE|PARENB);
1175 tmp_tc.c_cflag |= CS8;
1176- tmp_tc.c_oflag &= ~OPOST;
1177+ if (f & MODE_OUTBIN)
1178+ tmp_tc.c_oflag &= ~OPOST;
1179+ else
1180+ tmp_tc.c_oflag |= OPOST;
1181 } else {
1182 tmp_tc.c_cflag &= ~(CSIZE|PARENB);
1183 tmp_tc.c_cflag |= old_tc.c_cflag & (CSIZE|PARENB);
1184@@ -468,7 +475,7 @@ void TerminalNewMode(int f)
1185
1186 #ifdef SIGINFO
1187 signal(SIGINFO, ayt);
1188-#endif SIGINFO
1189+#endif /* SIGINFO */
1190
1191 #if defined(NOKERNINFO)
1192 tmp_tc.c_lflag |= NOKERNINFO;
1193@@ -504,7 +511,7 @@ void TerminalNewMode(int f)
1194
1195 #ifdef SIGINFO
1196 signal(SIGINFO, ayt_status);
1197-#endif SIGINFO
1198+#endif /* SIGINFO */
1199
1200 #ifdef SIGTSTP
1201 signal(SIGTSTP, SIG_DFL);
1202diff --git a/telnet/utilities.cc b/telnet/utilities.cc
1203index 0448f0a..66839ab 100644
1204--- a/telnet/utilities.cc
1205+++ b/telnet/utilities.cc
1206@@ -47,6 +47,8 @@ char util_rcsid[] =
1207 #include <sys/socket.h>
1208 #include <unistd.h>
1209 #include <ctype.h>
1210+#include <string.h>
1211+#include <stdlib.h>
1212
1213 #include "ring.h"
1214 #include "defines.h"
1215--
12161.8.4.2
1217
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/Warning-fix-in-the-step-of-install.patch b/meta-networking/recipes-netkit/netkit-telnet/files/Warning-fix-in-the-step-of-install.patch
deleted file mode 100644
index 9ac75439da..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/Warning-fix-in-the-step-of-install.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From 31362e4c0d02b4a2b952ad0dd32acfb573c442f3 Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Fri, 28 Nov 2014 07:17:40 +0900
4Subject: [PATCH 2/2] WARNING Fix and modify "CFLAGS"
5
6WARNING: QA Issue: File '/usr/sbin/in.telnetd' from netkit-telnet was
7already stripped, this will prevent future debugging! [already-stripped]
8
9Upstream-Status: Pending
10
11Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
12---
13 telnetd/Makefile | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/telnetd/Makefile b/telnetd/Makefile
17index 72650b4..a4cf9fa 100644
18--- a/telnetd/Makefile
19+++ b/telnetd/Makefile
20@@ -9,7 +9,8 @@ include ../MRULES
21 # take out -DPARANOID_TTYS.
22
23 CFLAGS += '-DISSUE_FILE="/etc/issue.net"' -DPARANOID_TTYS \
24- -DNO_REVOKE -DKLUDGELINEMODE -DDIAGNOSTICS
25+ -DNO_REVOKE -DKLUDGELINEMODE -DDIAGNOSTICS \
26+ -DLOGIN_WRAPPER=\"/${libdir}/telnetlogin\"
27 # LIBS += $(LIBTERMCAP)
28
29 OBJS = telnetd.o state.o termstat.o slc.o sys_term.o utility.o \
30@@ -27,7 +28,7 @@ $(OBJS): defs.h ext.h pathnames.h telnetd.h logwtmp.h logout.h setproctitle.h
31 telnetd.o: ../version.h
32
33 install: telnetd
34- install -s -m$(DAEMONMODE) telnetd $(INSTALLROOT)$(SBINDIR)/in.telnetd
35+ install -m$(DAEMONMODE) telnetd $(INSTALLROOT)$(SBINDIR)/in.telnetd
36 install -m$(MANMODE) issue.net.5 $(INSTALLROOT)$(MANDIR)/man5/
37 install -m$(MANMODE) telnetd.8 $(INSTALLROOT)$(MANDIR)/man8/in.telnetd.8
38 ln -sf in.telnetd.8 $(INSTALLROOT)$(MANDIR)/man8/telnetd.8
39--
401.8.4.2
41
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/cross-compile.patch b/meta-networking/recipes-netkit/netkit-telnet/files/cross-compile.patch
deleted file mode 100644
index b3fe36b7bb..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/cross-compile.patch
+++ /dev/null
@@ -1,48 +0,0 @@
1To support the cross-compile
2
3Upstream-Status: Pending
4
5make the configure to support the cross-compile, by only to compile the
6target, and not to run it
7
8Roy Li <rongqing.li@windriver.com>
9Index: netkit-telnet-0.17/configure
10===================================================================
11--- netkit-telnet-0.17.orig/configure 2008-11-23 22:01:26.000000000 +0100
12+++ netkit-telnet-0.17/configure 2008-11-23 22:05:00.000000000 +0100
13@@ -94,7 +94,7 @@
14 echo -n 'Checking if C compiler works... '
15 if (
16 $CC __conftest.c -o __conftest || exit 1
17- ./__conftest || exit 1
18+ # Idiots belong shot! ./__conftest || exit 1
19 ) >/dev/null 2>&1; then
20 echo 'yes'
21 else
22@@ -141,7 +141,7 @@
23 echo -n 'Checking if C++ compiler works... '
24 if (
25 $CXX __conftest.cc -o __conftest || exit 1
26- ./__conftest || exit 1
27+ # Iditios belong shot! ./__conftest || exit 1
28 ) >/dev/null 2>&1; then
29 echo 'yes'
30 else
31@@ -284,7 +284,7 @@
32 else
33 if (
34 $CXX $CXXFLAGS -D__USE_BSD_SIGNAL __conftest.cc -o __conftest || exit 1
35- ./__conftest || exit 1
36+ # running still does not work./__conftest || exit 1
37 ) >/dev/null 2>&1; then
38 echo '-D__USE_BSD_SIGNAL'
39 CFLAGS="$CFLAGS -D__USE_BSD_SIGNAL"
40@@ -501,7 +501,7 @@
41 EOF
42 if (
43 $CXX $CXXFLAGS __conftest.cc $LIBBSD -o __conftest || exit 1
44- ./__conftest || exit 1
45+ # argh! morons!./__conftest || exit 1
46 ) >/dev/null 2>&1; then
47 echo 'ok'
48 else
diff --git a/meta-networking/recipes-netkit/netkit-telnet/files/telnet-xinetd b/meta-networking/recipes-netkit/netkit-telnet/files/telnet-xinetd
deleted file mode 100644
index 12204c71b2..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/files/telnet-xinetd
+++ /dev/null
@@ -1,14 +0,0 @@
1# default: on
2# description: The telnet server serves telnet sessions; it uses \
3# unencrypted username/password pairs for authentication.
4service telnet
5{
6 flags = REUSE
7 socket_type = stream
8 wait = no
9 user = root
10 server = /usr/sbin/in.telnetd
11 log_on_failure += USERID
12 disable = yes
13}
14
diff --git a/meta-networking/recipes-netkit/netkit-telnet/netkit-telnet_0.17.bb b/meta-networking/recipes-netkit/netkit-telnet/netkit-telnet_0.17.bb
deleted file mode 100644
index d3de038d16..0000000000
--- a/meta-networking/recipes-netkit/netkit-telnet/netkit-telnet_0.17.bb
+++ /dev/null
@@ -1,74 +0,0 @@
1DESCRIPTION = "netkit-telnet includes the telnet daemon and client."
2HOMEPAGE = "http://www.hcs.harvard.edu/~dholland/computers/netkit.html"
3SECTION = "net"
4DEPENDS = "ncurses"
5LICENSE = "BSD-4-Clause"
6LIC_FILES_CHKSUM = "file://telnet/telnet.cc;beginline=2;endline=3;md5=780868e7b566313e70cb701560ca95ef"
7
8SRC_URI = "${DEBIAN_MIRROR}/main/n/netkit-telnet/netkit-telnet_${PV}.orig.tar.gz \
9 file://To-aviod-buffer-overflow-in-telnet.patch \
10 file://Warning-fix-in-the-step-of-install.patch \
11 file://telnet-xinetd \
12 file://cross-compile.patch \
13 file://0001-telnet-telnetd-Fix-print-format-strings.patch \
14 file://0001-telnet-telnetd-Fix-deadlock-on-cleanup.patch \
15 file://CVE-2020-10188.patch \
16 file://0001-telnetd-utility.c-Fix-buffer-overflow-in-netoprintf.patch \
17 file://0001-utility-Include-time.h-form-time-and-strftime-protot.patch \
18 file://0001-Drop-using-register-keyword.patch \
19 file://CVE-2022-39028.patch \
20 "
21
22UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/n/netkit-telnet/"
23UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)\.orig\.tar"
24
25EXTRA_OEMAKE = "INSTALLROOT=${D} SBINDIR=${sbindir} DAEMONMODE=755 \
26 MANMODE=644 MANDIR=${mandir}"
27
28do_configure () {
29 ./configure --prefix=${prefix}
30 sed -e 's#^CFLAGS=\(.*\)$#CFLAGS= -D_GNU_SOURCE \1#' \
31 -e 's#^CXXFLAGS=\(.*\)$#CXXFLAGS= -D_GNU_SOURCE \1#' \
32 -e 's#^LDFLAGS=.*$#LDFLAGS= ${LDFLAGS}#' \
33 -i MCONFIG
34}
35
36do_compile () {
37 oe_runmake 'CC=${CC}' 'LD=${LD}' 'LDFLAGS=${LDFLAGS}' SUB=telnet
38 oe_runmake 'CC=${CC}' 'LD=${LD}' 'LDFLAGS=${LDFLAGS}' LIBS=-lutil SUB=telnetd
39 oe_runmake 'CC=${CC}' 'LD=${LD}' 'LDFLAGS=${LDFLAGS}' SUB=telnetlogin
40}
41
42do_install () {
43 install -d ${D}${bindir}
44 install -m 0755 telnet/telnet ${D}${bindir}/telnet.${PN}
45 install -d ${D}${sbindir}
46 install -d ${D}${mandir}/man1
47 install -d ${D}${mandir}/man5
48 install -d ${D}${mandir}/man8
49 oe_runmake SUB=telnetd install
50 rm -rf ${D}${mandir}/man1
51 install -D -m 4750 ${B}/telnetlogin/telnetlogin ${D}/${libdir}/telnetlogin
52 # fix up hardcoded paths
53 sed -i -e 's,/usr/sbin/,${sbindir}/,' ${WORKDIR}/telnet-xinetd
54 install -d ${D}/etc/xinetd.d/
55 install -p -m644 ${WORKDIR}/telnet-xinetd ${D}/etc/xinetd.d/telnet
56}
57
58inherit update-alternatives
59
60ALTERNATIVE_PRIORITY = "100"
61ALTERNATIVE:${PN} = "telnet"
62ALTERNATIVE_LINK_NAME[telnet] = "${bindir}/telnet"
63ALTERNATIVE_TARGET[telnet] = "${bindir}/telnet.${PN}"
64
65ALTERNATIVE:${PN}-doc = "telnetd.8"
66ALTERNATIVE_LINK_NAME[telnetd.8] = "${mandir}/man8/telnetd.8"
67
68SRC_URI[md5sum] = "d6beabaaf53fe6e382c42ce3faa05a36"
69SRC_URI[sha256sum] = "9c80d5c7838361a328fb6b60016d503def9ce53ad3c589f3b08ff71a2bb88e00"
70FILES:${PN} += "${sbindir}/in.* ${libdir}/* ${sysconfdir}/xinetd.d/*"
71
72# http://errors.yoctoproject.org/Errors/Details/186954/
73COMPATIBLE_HOST:libc-musl = 'null'
74RCONFLICTS:${PN} = "inetutils-telnetd"
diff --git a/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/0001-tftp-Include-missing-fcntl.h.patch b/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/0001-tftp-Include-missing-fcntl.h.patch
deleted file mode 100644
index 78936907f6..0000000000
--- a/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/0001-tftp-Include-missing-fcntl.h.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From fa57e161fc953264a75d50a787cb83983e60acc7 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 30 Aug 2017 18:30:02 -0700
4Subject: [PATCH] tftp: Include missing fcntl.h
5
6Signed-off-by: Khem Raj <raj.khem@gmail.com>
7---
8Upstream-Status: Pending
9
10 tftp/main.c | 1 +
11 1 file changed, 1 insertion(+)
12
13diff --git a/tftp/main.c b/tftp/main.c
14index 8c54843..5c9b698 100644
15--- a/tftp/main.c
16+++ b/tftp/main.c
17@@ -63,6 +63,7 @@ char main_rcsid[] =
18 #include <ctype.h>
19 #include <netdb.h>
20 #include <unistd.h>
21+#include <fcntl.h>
22
23 #include "tftpsubs.h" /* for mysignal() */
24
25--
262.14.1
27
diff --git a/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/tftp.conf b/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/tftp.conf
deleted file mode 100644
index 7bc6ca96b6..0000000000
--- a/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp/tftp.conf
+++ /dev/null
@@ -1,11 +0,0 @@
1service tftp
2{
3 disable = no
4 socket_type = dgram
5 port = 69
6 protocol = udp
7 wait = yes
8 user = nobody
9 server = /usr/sbin/in.tftpd
10 server_args = /tftpboot
11}
diff --git a/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp_0.17.bb b/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp_0.17.bb
deleted file mode 100644
index 8de3e4a34c..0000000000
--- a/meta-networking/recipes-netkit/netkit-tftp/netkit-tftp_0.17.bb
+++ /dev/null
@@ -1,59 +0,0 @@
1SUMMARY = "tftp - Trivial file transfer protocol client"
2SECTION = "net"
3LICENSE = "BSD-4-Clause"
4DEPENDS = "tcp-wrappers"
5
6LIC_FILES_CHKSUM = "file://tftp/tftp.c;beginline=2;endline=3;md5=84d2cfe1e60863a7d82648734ba4d30c"
7
8SRC_URI = "${DEBIAN_MIRROR}/main/n/${BPN}/${BPN}_${PV}.orig.tar.gz;name=archive \
9 ${DEBIAN_MIRROR}/main/n/${BPN}/${BPN}_${PV}-18.diff.gz;name=patch18 \
10 file://tftp.conf \
11 file://0001-tftp-Include-missing-fcntl.h.patch \
12 "
13
14SRC_URI[archive.md5sum] = "b7262c798e2ff50e29c2ff50dfd8d6a8"
15SRC_URI[archive.sha256sum] = "3a43c0010d4e61f412563fd83769d4667d8b8e82903526d21cb9205fe55ad14d"
16SRC_URI[patch18.md5sum] = "cb29e7a33dd85105ba6e6ec4f971e42c"
17SRC_URI[patch18.sha256sum] = "092437d27b4fa88c044ef6290372fee5ce06d223607f0e22a6e527065c8930e7"
18
19inherit autotools-brokensep update-alternatives
20
21do_configure () {
22 ./configure --prefix=${prefix}
23 echo "CFLAGS=${CFLAGS}" > MCONFIG
24}
25
26do_compile () {
27 oe_runmake 'CC=${CC}' 'LD=${LD}' 'LDFLAGS=${LDFLAGS}' 'CFLAGS=${CFLAGS}'
28}
29
30do_install () {
31 install -d ${D}${bindir}
32 install -d ${D}${sbindir}
33 install -d ${D}${mandir}/man1
34 install -d ${D}${mandir}/man8
35 install -d ${D}${sysconfdir}/xinetd.d
36
37 sed -i 's/install -s/install/' tftp/Makefile
38 sed -i 's/install -s/install/' tftpd/Makefile
39
40 oe_runmake 'INSTALLROOT=${D}' 'BINMODE=0755' \
41 'DAEMONMODE=0755' 'MANMODE=0644' \
42 'BINDIR=${bindir}' 'SBINDIR=${sbindir}' \
43 'MANDIR=${mandir}' install
44
45 install ${WORKDIR}/tftp.conf ${D}/${sysconfdir}/xinetd.d/tftp
46}
47
48PACKAGES = "${PN}-client ${PN}-server ${PN}-doc ${BPN}-dbg"
49FILES:${PN}-client = "${bindir}/*"
50FILES:${PN}-server = "${sbindir}/* ${sysconfdir}/xinetd.d/*"
51FILES:${PN}-doc = "${mandir}"
52FILES:${PN}-dbg = "${prefix}/src/debug \
53 ${bindir}/.debug ${sbindir}/.debug"
54
55RDEPENDS:${PN}-server = "tcp-wrappers xinetd"
56
57ALTERNATIVE_PRIORITY = "100"
58ALTERNATIVE:${PN}-client = "tftp"
59ALTERNATIVE_LINK_NAME[tftp] = "${bindir}/tftp"