From ac1079b24d793a9ca1a990d7f18b210c26bae77c Mon Sep 17 00:00:00 2001 From: Jiri Popelka Date: Thu, 20 Nov 2014 11:09:45 +0100 Subject: [PATCH] ether-wake: apply Debian's hardening patch --- ether-wake-interfaces.patch | 49 ++++++++++++++++++++++++++----------- net-tools.spec | 5 +++- 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/ether-wake-interfaces.patch b/ether-wake-interfaces.patch index bf26b04..a164205 100644 --- a/ether-wake-interfaces.patch +++ b/ether-wake-interfaces.patch @@ -1,6 +1,7 @@ ---- a/ether-wake.c 2013-09-03 18:15:13.000000000 +0200 -+++ b/ether-wake.c 2013-09-03 17:39:02.000000000 +0200 -@@ -22,7 +22,7 @@ +diff -up net-tools-2.0/ether-wake.c.interfaces net-tools-2.0/ether-wake.c +--- net-tools-2.0/ether-wake.c.interfaces 2014-11-20 11:06:36.945067589 +0100 ++++ net-tools-2.0/ether-wake.c 2014-11-20 11:07:22.984416283 +0100 +@@ -22,7 +22,7 @@ static char usage_msg[] = " Options:\n" " -b Send wake-up packet to the broadcast address.\n" " -D Increase the debug level.\n" @@ -9,7 +10,7 @@ " -p Append the four or six byte password PW to the packet.\n" " A password is only required for a few adapter types.\n" " The password may be specified in ethernet hex format\n" -@@ -89,6 +89,9 @@ +@@ -89,6 +89,9 @@ static char usage_msg[] = #include #include @@ -19,7 +20,7 @@ /* Grrr, no consistency between include versions. Enable this if setsockopt() isn't declared with your library. */ #if 0 -@@ -110,20 +113,29 @@ +@@ -110,20 +113,29 @@ static int get_dest_addr(const char *arg static int get_fill(unsigned char *pkt, struct ether_addr *eaddr); static int get_wol_pw(const char *optarg); @@ -57,7 +58,25 @@ while ((c = getopt(argc, argv, "bDi:p:uvV")) != -1) switch (c) { -@@ -177,13 +189,45 @@ +@@ -131,7 +143,7 @@ int main(int argc, char *argv[]) + case 'D': debug++; break; + case 'i': ifname = optarg; break; + case 'p': get_wol_pw(optarg); break; +- case 'u': printf(usage_msg); return 0; ++ case 'u': printf("%s",usage_msg); return 0; + case 'v': verbose++; break; + case 'V': do_version++; break; + case '?': +@@ -140,7 +152,7 @@ int main(int argc, char *argv[]) + if (verbose || do_version) + printf("%s\n", version_msg); + if (errflag) { +- fprintf(stderr, brief_usage_msg); ++ fprintf(stderr,"%s", brief_usage_msg); + return 3; + } + +@@ -177,13 +189,45 @@ int main(int argc, char *argv[]) pktsize = get_fill(outpack, &eaddr); @@ -97,7 +116,7 @@ if (! opt_no_src_addr) { struct ifreq if_hwaddr; - unsigned char *hwaddr = if_hwaddr.ifr_hwaddr.sa_data; -+ char *hwaddr = if_hwaddr.ifr_hwaddr.sa_data; ++ const char *hwaddr = if_hwaddr.ifr_hwaddr.sa_data; - strcpy(if_hwaddr.ifr_name, ifname); + strncpy(if_hwaddr.ifr_name, ifname, IFNAMSIZ); @@ -105,7 +124,7 @@ if (ioctl(s, SIOCGIFHWADDR, &if_hwaddr) < 0) { fprintf(stderr, "SIOCGIFHWADDR on %s failed: %s\n", ifname, strerror(errno)); -@@ -220,7 +264,8 @@ +@@ -220,7 +264,8 @@ int main(int argc, char *argv[]) #if defined(PF_PACKET) { struct ifreq ifr; @@ -115,9 +134,10 @@ if (ioctl(s, SIOCGIFINDEX, &ifr) == -1) { fprintf(stderr, "SIOCGIFINDEX on %s failed: %s\n", ifname, strerror(errno)); ---- a/Makefile 2013-09-03 13:15:22.531951613 +0100 -+++ b/Makefile 2013-09-03 13:24:29.659823455 +0100 -@@ -188,6 +188,8 @@ +diff -up net-tools-2.0/Makefile.interfaces net-tools-2.0/Makefile +--- net-tools-2.0/Makefile.interfaces 2014-10-07 03:26:10.000000000 +0200 ++++ net-tools-2.0/Makefile 2014-11-20 11:06:36.955067448 +0100 +@@ -193,6 +193,8 @@ ipmaddr: $(NET_LIB) ipmaddr.o mii-tool: $(NET_LIB) mii-tool.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mii-tool.o $(NLIB) $(RESLIB) @@ -126,9 +146,10 @@ installbin: @echo @echo "######################################################" ---- a/man/en_US/ether-wake.8 2013-09-03 13:15:22.576952098 +0100 -+++ b/man/en_US/ether-wake.8 2013-09-03 13:14:55.270657575 +0100 -@@ -49,7 +49,7 @@ +diff -up net-tools-2.0/man/en_US/ether-wake.8.interfaces net-tools-2.0/man/en_US/ether-wake.8 +--- net-tools-2.0/man/en_US/ether-wake.8.interfaces 2014-11-20 11:06:36.947067561 +0100 ++++ net-tools-2.0/man/en_US/ether-wake.8 2014-11-20 11:06:36.955067448 +0100 +@@ -49,7 +49,7 @@ Send the wake-up packet to the broadcast Increase the Debug Level. .TP .B \-i ifname diff --git a/net-tools.spec b/net-tools.spec index c5e95d7..71c5ed4 100644 --- a/net-tools.spec +++ b/net-tools.spec @@ -3,7 +3,7 @@ Summary: Basic networking tools Name: net-tools Version: 2.0 -Release: 0.29.%{checkout}%{?dist} +Release: 0.30.%{checkout}%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://sourceforge.net/projects/net-tools/ @@ -167,6 +167,9 @@ install -D -p -m 644 %{SOURCE9} %{buildroot}%{_unitdir}/arp-ethers.service %attr(0644,root,root) %{_unitdir}/arp-ethers.service %changelog +* Thu Nov 20 2014 Jiri Popelka - 2.0-0.30.20141007git +- ether-wake: apply Debian's hardening patch + * Tue Oct 07 2014 Jiri Popelka - 2.0-0.29.20141007git - latest upstream snapshot (#1149405)