From 821ae9745f018c25a2851e55a776c119f8c2865fef8b5b3230160c640bfb8e74 Mon Sep 17 00:00:00 2001 From: OBS User mrdocs Date: Sun, 6 Nov 2016 14:12:51 +0000 Subject: [PATCH] Accepting request 438129 from home:yecril71pl:branches:network:utilities MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BugĀ 1006375 - package net-tools does not provide COPYING OBS-URL: https://build.opensuse.org/request/show/438129 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-tools?expand=0&rev=52 --- net-tools-1.60-use-gai.patch | 175 +++++++++++++++++++++++++++++++++++ net-tools.changes | 7 ++ net-tools.spec | 111 ++++++++++++++++------ 3 files changed, 266 insertions(+), 27 deletions(-) create mode 100644 net-tools-1.60-use-gai.patch diff --git a/net-tools-1.60-use-gai.patch b/net-tools-1.60-use-gai.patch new file mode 100644 index 0000000..e877c7d --- /dev/null +++ b/net-tools-1.60-use-gai.patch @@ -0,0 +1,175 @@ +--- o/lib/inet.c 2016-11-01 01:21:04.603738000 +0100 ++++ n/lib/inet.c 2016-11-01 01:16:39.432527900 +0100 +@@ -73,14 +73,15 @@ + + static struct addr *INET_nn = NULL; /* addr-to-name cache */ + ++#define gethostbyname(N) NULL + + static int INET_resolve(char *name, struct sockaddr_in *sin, int hostfirst) + { + struct hostent *hp; + struct netent *np; +- ++ struct addrinfo * ai, hints = { 0 }; + /* Grmpf. -FvK */ +- sin->sin_family = AF_INET; ++ hints .ai_family = sin->sin_family = AF_INET; + sin->sin_port = 0; + + /* Default is special, meaning 0.0.0.0. */ +@@ -96,6 +97,14 @@ + #ifdef DEBUG + if (hostfirst) fprintf (stderr, "gethostbyname (%s)\n", name); + #endif ++ if (hostfirst) ++ { ++ int const e = getaddrinfo (name, NULL, &hints, &ai); ++ switch (e) ++ { ++ case 0: memcpy (&sin ->sin_addr, ai ->ai_addr, ai ->ai_addrlen); freeaddrinfo (ai); return 0; ++ case EAI_AGAIN: h_errno = TRY_AGAIN; break; default: h_errno = NO_RECOVERY; break; } ++ } + if (hostfirst && + (hp = gethostbyname(name)) != (struct hostent *) NULL) { + memcpy((char *) &sin->sin_addr, (char *) hp->h_addr_list[0], +@@ -123,6 +132,13 @@ + #ifdef DEBUG + fprintf (stderr, "gethostbyname (%s)\n", name); + #endif ++ { ++ int const e = getaddrinfo (name, NULL, &hints, &ai); ++ switch (e) ++ { ++ case 0: memcpy (&sin ->sin_addr, ai ->ai_addr, ai ->ai_addrlen); freeaddrinfo (ai); return 0; ++ case EAI_AGAIN: h_errno = TRY_AGAIN; break; default: h_errno = NO_RECOVERY; break; } ++ } + if ((hp = gethostbyname(name)) == (struct hostent *) NULL) { + errno = h_errno; + return -1; +--- o/rarp.c 2001-04-08 18:05:05.000000000 +0100 ++++ n/rarp.c 2016-11-01 10:18:47.603745500 +0100 +@@ -48,19 +48,18 @@ + static struct hwtype *hardware = NULL; + + /* Delete an entry from the RARP cache. */ +-static int rarp_delete(int fd, struct hostent *hp) ++static int rarp_delete(int fd, struct addrinfo *ai) + { + struct arpreq req; + struct sockaddr_in *si; + unsigned int found = 0; +- char **addr; + + /* The host can have more than one address, so we loop on them. */ +- for (addr = hp->h_addr_list; *addr != NULL; addr++) { ++ for (; ai != NULL; ai = ai ->ai_next) { + memset((char *) &req, 0, sizeof(req)); + si = (struct sockaddr_in *) &req.arp_pa; +- si->sin_family = hp->h_addrtype; +- memcpy((char *) &si->sin_addr, *addr, hp->h_length); ++ si->sin_family = ai ->ai_family; ++ memcpy((char *) &si->sin_addr, ai ->ai_addr, ai ->ai_addrlen); + + /* Call the kernel. */ + if (ioctl(fd, SIOCDRARP, &req) == 0) { +@@ -80,13 +79,13 @@ + } + + if (found == 0) +- printf(_("no RARP entry for %s.\n"), hp->h_name); ++ printf(_("no RARP entry for %s.\n"), ai ->ai_canonname); + return 0; + } + + + /* Set an entry in the RARP cache. */ +-static int rarp_set(int fd, struct hostent *hp, char *hw_addr) ++static int rarp_set(int fd, struct addrinfo *ai, char *hw_addr) + { + struct arpreq req; + struct sockaddr_in *si; +@@ -99,8 +98,8 @@ + /* Clear and fill in the request block. */ + memset((char *) &req, 0, sizeof(req)); + si = (struct sockaddr_in *) &req.arp_pa; +- si->sin_family = hp->h_addrtype; +- memcpy((char *) &si->sin_addr, hp->h_addr_list[0], hp->h_length); ++ si->sin_family = ai->ai_family; ++ memcpy((char *) &si->sin_addr, ai->ai_addr, ai->ai_addrlen); + req.arp_ha.sa_family = hardware->type; + memcpy(req.arp_ha.sa_data, sap.sa_data, hardware->alen); + +@@ -122,7 +121,7 @@ + char *host, *addr; + int linenr; + FILE *fp; +- struct hostent *hp; ++ struct addrinfo * ai, hints = {}; hints .ai_family = AF_INET; + + if ((fp = fopen(name, "r")) == NULL) { + fprintf(stderr, _("rarp: cannot open file %s:%s.\n"), name, strerror(errno)); +@@ -140,11 +139,16 @@ + fprintf(stderr, _("rarp: format error at %s:%u\n"), name, linenr); + continue; + } +- if ((hp = gethostbyname(host)) == NULL) { +- fprintf(stderr, _("rarp: %s: unknown host\n"), host); +- } +- if (rarp_set(fd, hp, addr) != 0) { +- fprintf(stderr, _("rarp: cannot set entry from %s:%u\n"), name, linenr); ++ { ++ int const e = getaddrinfo (host, NULL, &hints, &ai); ++ if (e) ++ fprintf(stderr, _("rarp: %s: unknown host\n"), host); ++ else { ++ if (rarp_set(fd, ai, addr) != 0) { ++ fprintf(stderr, _("rarp: cannot set entry from %s:%u\n"), name, linenr); ++ } ++ freeaddrinfo (ai); ++ } + } + } + +@@ -205,7 +209,6 @@ + { + int result = 0, mode = 0, c, nargs = 0, verbose = 0; + char *args[3]; +- struct hostent *hp; + int fd; + + #if I18N +@@ -225,7 +228,7 @@ + case 'h': + usage(); + case 'V': +- fprintf(stderr, version_string); ++ fputs (version_string, stderr); + exit(E_VERSION); + break; + case 'v': +@@ -285,16 +288,21 @@ + if (nargs != (mode - 1)) { + usage(); + } +- if ((hp = gethostbyname(args[0])) == NULL) { ++ { ++ struct addrinfo * ai, hints = {}; hints .ai_family = AF_INET; hints .ai_flags = AI_CANONNAME; ++ int const e = getaddrinfo ((args[0]), NULL, &hints, &ai); ++ if (e) { + fprintf(stderr, _("rarp: %s: unknown host\n"), args[0]); + exit(1); +- } ++ } + if (fd = socket(PF_INET, SOCK_DGRAM, 0), fd < 0) { + perror("socket"); + exit(1); + } +- result = (mode == MODE_DELETE) ? rarp_delete(fd, hp) : rarp_set(fd, hp, args[1]); ++ result = (mode == MODE_DELETE) ? rarp_delete(fd, ai) : rarp_set(fd, ai, args[1]); + close(fd); ++ freeaddrinfo (ai); ++ } + break; + + case MODE_ETHERS: diff --git a/net-tools.changes b/net-tools.changes index b73dd9f..3a54191 100644 --- a/net-tools.changes +++ b/net-tools.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Nov 1 10:01:53 UTC 2016 - giecrilj@stegny.2a.pl + +- add COPYING +- net-tools-1.60-use-gai.patch: + use getaddrinfo instead of gethostbyname + ------------------------------------------------------------------- Mon Oct 17 07:39:12 UTC 2016 - schwab@suse.de diff --git a/net-tools.spec b/net-tools.spec index 19d5519..880ac8b 100644 --- a/net-tools.spec +++ b/net-tools.spec @@ -17,25 +17,29 @@ Name: net-tools -Url: http://www.tazenda.demon.co.uk/phil/net-tools/ -Provides: iputils:/usr/sbin/traceroute6 -Provides: net_tool -Obsoletes: net_tool -#force new traceroute or else.. -Recommends: traceroute >= 2.0.0 -# provides hostname, domainname and dnsdomainname -Requires: hostname +Url: https://sourceforge.net/projects/net-tools/ Version: 1.60 Release: 0 Summary: Important Programs for Networking License: GPL-2.0+ Group: Productivity/Networking/Other +Requires: hostname +Provides: iputils:/usr/sbin/traceroute6 +Provides: net_tool = %version +Obsoletes: net_tool < %version +%if 0%{?suse_version} +Recommends: %name-lang = %version +#force new traceroute or else.. +Recommends: traceroute >= 2.0.0 +%endif +# provides hostname, domainname and dnsdomainname BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: http://www.tazenda.demon.co.uk/phil/net-tools/net-tools-%{version}.tar.bz2 Source2: netstat.xinetd Source3: nstrcmp.c Source4: ether-wake.c Source5: ether-wake.8 +BuildRequires: help2man Patch: net-tools-%{version}.dif Patch1: netstat-trunc.dif Patch2: manpages.diff @@ -68,7 +72,7 @@ Patch33: net-tools-1.60-ifconfig-SIOCSIFNETMASK.diff Patch34: net-tools-1.60-interface_socket.diff Patch35: net-tools-1.60-interface_mtu.diff Patch36: net-tools-1.60-printval-conversion.patch -Patch38: net-tools-1.60-obsolete.diff +#Patch38: net-tools-1.60-obsolete.diff Patch39: net-tools-1.60-fclose.diff Patch40: net-tools-1.60-notrim.diff Patch41: net-tools-1.60-ipv6-statistics.diff @@ -86,6 +90,7 @@ Patch52: net-tools-1.60-plipconfig-ecode.patch # PATCH-FIX-UPSTREAM net-tools-1.60-hostname-s.patch boo#872264 ticket#14 commit#452f8e Patch53: net-tools-1.60-hostname-s.patch Patch54: net-tools-1.60-fix-header-conflict.patch +Patch55: net-tools-1.60-use-gai.patch %description This package contains essential programs for network administration and @@ -101,6 +106,8 @@ Authors: Peter Tobias Olaf Kirch +%lang_package + %package deprecated Summary: Deprecated Networking Utilities Group: Productivity/Networking/Other @@ -114,7 +121,7 @@ which have been replaced by tools from the iproute2 package: * route -> ip r %prep -%setup -q +%setup cp %{S:3} lib/ %patch %patch1 @@ -149,7 +156,7 @@ cp %{S:3} lib/ %patch35 -p1 %patch36 -p1 #not applied, see bugzilla discussion -##%patch38 -p1 +%{nil %patch38 -p1} %patch39 -p1 %patch40 -p1 %patch41 @@ -166,14 +173,50 @@ cp %{S:3} lib/ %patch52 -p1 %patch53 -p1 %patch54 -p1 +%patch55 -p1 cp %{S:4} . cp %{S:5} ./man/en_US +COPYING='%{_docdir}/rpmlint-mini/COPYING' +if test -r "${COPYING}" && ! diff -u COPYING "${COPYING}" # diff failed +then # The file COPYING distributed by upstream is not genuine; I have reported the case to . +# Upstream contains a valid version in master but it has not been released yet (Bug #25). +# In the mean time: +# 1. Verify that the intention of the authors is to release under GPLv2. +while read line +do case "${line}" in +('*'*' GNU General') read line +case "${line}" in +('* Public License '*) read line +case "${line}" in +('*'*' version 2 of the License,'*) gpl=2 +break +esac +esac +esac +done < arp.c +test "${gpl}" -eq 2 +# 2. Verify that the file at $COPYING contains GPLv2. +while : +do read line +case "${line}" in +('GNU GENERAL PUBLIC LICENSE') read line +case "${line}" in +('Version 2,'*) break +esac +esac +exit 1 +done < "${COPYING}" +# 3. Replace the faulty file with a correct one. +cp -t. "${COPYING}" +fi # diff failed %build # Kernel 3.6 removes if_strip.h - disable STRIP %if 0%{?suse_version} > 1220 %__sed -i -e '/HAVE_HWSTRIP y/s/y$/n/' config.in +%else +test -r %{_includedir}/linux/if_strip.h || sed -i -e '/HAVE_HWSTRIP y/s/y$/n/' config.in %endif # @@ -182,9 +225,9 @@ make COPTS="-D_GNU_SOURCE $RPM_OPT_FLAGS" LOPTS="$RPM_OPT_FLAGS" gcc $RPM_OPT_FLAGS -D_GNU_SOURCE -fwhole-program -o ether-wake ether-wake.c %install -install -d -m 755 $RPM_BUILD_ROOT/etc/xinetd.d -install -m 644 %{S:2} $RPM_BUILD_ROOT/etc/xinetd.d/netstat -make install BASEDIR=$RPM_BUILD_ROOT +install -d -m 755 %{buildroot}/etc/xinetd.d +install -m 644 %{S:2} %{buildroot}/etc/xinetd.d/netstat +make install BASEDIR=%{buildroot} install -m 755 ether-wake %{buildroot}/sbin for tool in \ %ifarch s390 @@ -192,39 +235,53 @@ for tool in \ %endif hostname domainname dnsdomainname nisdomainname ypdomainname mii-tool rarp do - rm -f $RPM_BUILD_ROOT/*bin/$tool - rm -f $RPM_BUILD_ROOT/%{_mandir}/man*/$tool.* - rm -f $RPM_BUILD_ROOT/%{_mandir}/*/man*/$tool.* + rm -f %{buildroot}/*bin/$tool + rm -f %{buildroot}/%{_mandir}/man*/$tool.* + rm -f %{buildroot}/%{_mandir}/*/man*/$tool.* done -mv $RPM_BUILD_ROOT/%{_mandir}/de_DE $RPM_BUILD_ROOT/%{_mandir}/de -mv $RPM_BUILD_ROOT/%{_mandir}/fr_FR $RPM_BUILD_ROOT/%{_mandir}/fr +mv %{buildroot}/%{_mandir}/de_DE %{buildroot}/%{_mandir}/de +mv %{buildroot}/%{_mandir}/fr_FR %{buildroot}/%{_mandir}/fr %if 0%{?suse_version} < 1120 -rm -rf $RPM_BUILD_ROOT/%{_mandir}/pt_BR +rm -rf %{buildroot}/%{_mandir}/pt_BR %endif +for tool in iptunnel ipmaddr +do t="%{buildroot}/%{_mandir}/man8/${tool}.8" +help2man -s8 "%{buildroot}/sbin/${tool}" --no-discard-stderr >"${t}" +gzip "${t}" +done %find_lang %{name} --all-name --with-man # generate the filelist for net-tools-deprecated -echo '%%defattr(-,root,root)' >deprecated.list for tool in arp ifconfig ipmaddr iptunnel netstat route; do for dir in bin sbin; do - if test -x $RPM_BUILD_ROOT/$dir/$tool; then + if test -x "%{buildroot}/$dir/$tool"; then break fi done - echo /$dir/$tool >>deprecated.list + p="/$dir/$tool" + echo "$p" + echo "%%exclude $p" >>excluded.list find $RPM_BUILD_ROOT/%_mandir -name "$tool.*"\ - -printf '%_mandir/%%P*\n' >>deprecated.list -done + -printf '%_mandir/%%P*\n' +done >deprecated.list cat deprecated.list -sed 's/^/%%exclude /' deprecated.list >>%name.lang +for p in $(excluded.list -%files -f %{name}.lang +%files -f excluded.list %defattr(-,root,root) /bin/* /sbin/* %_mandir/man*/* %config(noreplace) /etc/xinetd.d/netstat +%doc COPYING README ABOUT-NLS README.ipv6 %files deprecated -f deprecated.list +%defattr(-,root,root) +%doc COPYING + +%files lang -f %{name}.lang +%doc COPYING %changelog