From dddbf49e53a7e2d076b1005c6ca96aa0fbbcadb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Tue, 22 Mar 2022 17:25:28 +0100 Subject: [PATCH 1/5] Change --mapfile to --map-file in tftpd(8) ... as the option is called --map-file. --- tftp-doc.patch | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tftp-doc.patch b/tftp-doc.patch index 20352c9..f1cb511 100644 --- a/tftp-doc.patch +++ b/tftp-doc.patch @@ -25,3 +25,21 @@ Specify the use of filename remapping. The .I remap-file is a file containing the remapping rules. See the section on filename +@@ -243,7 +243,7 @@ option, but crash with an error if they + accepted by the server. + .SH "FILENAME REMAPPING" + The +-.B \-\-mapfile ++.B \-\-map\-file + option specifies a file which contains filename remapping rules. Each + non-comment line (comments begin with hash marks, + .BR # ) +@@ -395,7 +395,7 @@ flag is used to set up a chroot() enviro + once a connection has been set up. + .PP + Finally, the filename remapping +-.RB ( \-\-mapfile ++.RB ( \-\-map\-file + flag) support can be used to provide a limited amount of additional + access control. + .SH "CONFORMING TO" From ff9bbfbd823011340c78f91c48e173ea4bd665cc Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 29 Mar 2022 12:36:32 +0200 Subject: [PATCH 2/5] =?UTF-8?q?fix=20the=20--mapfile/--map-file=20discrepa?= =?UTF-8?q?ncy=20in=20the=20manual=20page=20(Luk=C3=A1=C5=A1=20Zaoral)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tftp.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tftp.spec b/tftp.spec index fafbee5..c126931 100644 --- a/tftp.spec +++ b/tftp.spec @@ -4,7 +4,7 @@ Summary: The client for the Trivial File Transfer Protocol (TFTP) Name: tftp Version: 5.2 -Release: 32%{?dist} +Release: 33%{?dist} License: BSD URL: http://www.kernel.org/pub/software/network/tftp/ Source0: http://www.kernel.org/pub/software/network/tftp/tftp-hpa/tftp-hpa-%{version}.tar.bz2 @@ -103,6 +103,9 @@ install -p -m 644 %SOURCE2 ${RPM_BUILD_ROOT}%{_unitdir} %{_unitdir}/* %changelog +* Tue Mar 29 2022 Dominik Mierzejewski - 5.2-33 +- fix the --mapfile/--map-file discrepancy in the manual page (Lukáš Zaoral) + * Wed Jan 27 2021 Fedora Release Engineering - 5.2-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From 24c8d74d30030587421aa7d6d5ce96b7ab7e0678 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 29 Mar 2022 12:42:35 +0200 Subject: [PATCH 3/5] =?UTF-8?q?fix=20off-by-one=20reads=20and=20writes=20w?= =?UTF-8?q?hen=20filename=20remapping=20with=20macro=20\x=20is=20used=20(L?= =?UTF-8?q?uk=C3=A1=C5=A1=20Zaoral)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tftp-off-by-one.patch | 44 +++++++++++++++++++++++++++++++++++++++++++ tftp.spec | 4 ++++ 2 files changed, 48 insertions(+) create mode 100644 tftp-off-by-one.patch diff --git a/tftp-off-by-one.patch b/tftp-off-by-one.patch new file mode 100644 index 0000000..98b0874 --- /dev/null +++ b/tftp-off-by-one.patch @@ -0,0 +1,44 @@ +Resolves: #1485943 + +--- a/tftpd/tftpd.c 2017-08-28 09:12:11.681299000 +0200 ++++ b/tftpd/tftpd.c 2017-08-28 13:30:03.109312000 +0200 +@@ -1388,24 +1388,25 @@ + return strlen(p); + + case 'x': +- if (output) { +- if (from.sa.sa_family == AF_INET) { ++ if (from.sa.sa_family == AF_INET) { ++ if (output) { + sprintf(output, "%08lX", + (unsigned long)ntohl(from.si.sin_addr.s_addr)); +- l = 8; ++ } ++ l = 8; + #ifdef HAVE_IPV6 +- } else { +- unsigned char *c = (unsigned char *)SOCKADDR_P(&from); +- p = tb; +- for (l = 0; l < 16; l++) { +- sprintf(p, "%02X", *c); +- c++; +- p += 2; +- } ++ } else { ++ unsigned char *c = (unsigned char *)SOCKADDR_P(&from); ++ p = tb; ++ for (l = 0; l < 16; l++) { ++ sprintf(p, "%02X", *c); ++ c++; ++ p += 2; ++ } ++ if (output) + strcpy(output, tb); +- l = strlen(tb); ++ l = strlen(tb); + #endif +- } + } + return l; + + diff --git a/tftp.spec b/tftp.spec index c126931..6ec19ab 100644 --- a/tftp.spec +++ b/tftp.spec @@ -22,6 +22,7 @@ Patch8: tftp-hpa-5.2-pktinfo.patch Patch9: tftp-doc.patch Patch10: tftp-enhanced-logging.patch Patch11: tftp-hpa-5.2-gcc10.patch +Patch12: tftp-off-by-one.patch BuildRequires: make BuildRequires: gcc @@ -61,6 +62,7 @@ systemd socket activation, and is disabled by default. %patch9 -p1 -b .doc %patch10 -p1 -b .logging %patch11 -p1 -b .gcc10 +%patch12 -p1 -b .off-by-one %build autoreconf @@ -105,6 +107,8 @@ install -p -m 644 %SOURCE2 ${RPM_BUILD_ROOT}%{_unitdir} %changelog * Tue Mar 29 2022 Dominik Mierzejewski - 5.2-33 - fix the --mapfile/--map-file discrepancy in the manual page (Lukáš Zaoral) +- fix off-by-one reads and writes when filename remapping with macro \x is used + (Lukáš Zaoral) * Wed Jan 27 2021 Fedora Release Engineering - 5.2-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From 9d2b9924d85cc8e76e94d3b8b10a243392705350 Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 29 Mar 2022 12:56:27 +0200 Subject: [PATCH 4/5] use correct dependency for systemd rpm macros sort deps alphabetically --- tftp.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tftp.spec b/tftp.spec index 6ec19ab..8a9b080 100644 --- a/tftp.spec +++ b/tftp.spec @@ -24,9 +24,11 @@ Patch10: tftp-enhanced-logging.patch Patch11: tftp-hpa-5.2-gcc10.patch Patch12: tftp-off-by-one.patch +BuildRequires: autoconf +BuildRequires: gcc BuildRequires: make -BuildRequires: gcc -BuildRequires: readline-devel autoconf systemd-units +BuildRequires: readline-devel +BuildRequires: systemd-rpm-macros %description The Trivial File Transfer Protocol (TFTP) is normally used only for @@ -109,6 +111,7 @@ install -p -m 644 %SOURCE2 ${RPM_BUILD_ROOT}%{_unitdir} - fix the --mapfile/--map-file discrepancy in the manual page (Lukáš Zaoral) - fix off-by-one reads and writes when filename remapping with macro \x is used (Lukáš Zaoral) +- use correct dependency for systemd rpm macros and sort deps alphabetically * Wed Jan 27 2021 Fedora Release Engineering - 5.2-32 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild From ecb585be9ba92fcbae632e031385ba6507bacead Mon Sep 17 00:00:00 2001 From: Dominik 'Rathann' Mierzejewski Date: Tue, 29 Mar 2022 12:59:47 +0200 Subject: [PATCH 5/5] clean-up: remove redundant/unused lines --- tftp.spec | 2 -- 1 file changed, 2 deletions(-) diff --git a/tftp.spec b/tftp.spec index 8a9b080..91f19fd 100644 --- a/tftp.spec +++ b/tftp.spec @@ -1,4 +1,3 @@ -%global systemctl_bin /usr/bin/systemctl %global _hardened_build 1 Summary: The client for the Trivial File Transfer Protocol (TFTP) @@ -72,7 +71,6 @@ autoreconf make %{?_smp_mflags} %install -rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_bindir} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,8} mkdir -p ${RPM_BUILD_ROOT}%{_sbindir}