Compare commits

..

No commits in common. 'c9' and 'c8' have entirely different histories.
c9 ... c8

2
.gitignore vendored

@ -1 +1 @@
SOURCES/libgtop-2.40.0.tar.xz
SOURCES/libgtop-2.38.0.tar.xz

@ -1 +1 @@
5e0cdf1d986ec5d4ce0b244bdcded7de1a93149a SOURCES/libgtop-2.40.0.tar.xz
c04fbc2260aaec89c9d598a84762788d18f87608 SOURCES/libgtop-2.38.0.tar.xz

@ -1,167 +0,0 @@
From 3cb07d9c440d7bf0c4f8877a68a8d7467b97a238 Mon Sep 17 00:00:00 2001
From: David King <amigadave@amigadave.com>
Date: Mon, 6 Jun 2022 17:30:40 +0100
Subject: [PATCH] Avoid some deprecated networking functions
rpminspect trips up on some old networking functions in libgtop, which
are mentioned as deprecated in the Linux man pages.
inet_ntoa() only works on IPv4 addresses, whereas the newer inet_ntop()
works on both IPv4 and IPv6 addresses, so use inet_ntop() instead.
Similarly, use getaddrinfo() rather than gethostbyname(), and avoid
inet_addr() entirely.
https://bugzilla.redhat.com/show_bug.cgi?id=2050712
---
examples/netload.c | 10 +++-------
src/daemon/gnuserv.c | 20 ++++++++++++++------
sysdeps/common/gnuslib.c | 16 ++++++++++------
3 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/examples/netload.c b/examples/netload.c
index 979b245d..520b5040 100644
--- a/examples/netload.c
+++ b/examples/netload.c
@@ -66,7 +66,7 @@ main (int argc, char *argv [])
glibtop_netload netload;
unsigned method, count, port;
struct in_addr addr, subnet;
- char *address_string, *subnet_string;
+ char address_string[INET_ADDRSTRLEN], subnet_string[INET_ADDRSTRLEN];
char address6_string[INET6_ADDRSTRLEN], prefix6_string[INET6_ADDRSTRLEN];
char *hwaddress_string;
char buffer [BUFSIZ];
@@ -105,9 +105,8 @@ main (int argc, char *argv [])
addr.s_addr = netload.address;
subnet.s_addr = netload.subnet;
- address_string = g_strdup (inet_ntoa (addr));
- subnet_string = g_strdup (inet_ntoa (subnet));
-
+ inet_ntop (AF_INET, &addr, address_string, INET_ADDRSTRLEN);
+ inet_ntop (AF_INET, &subnet, subnet_string, INET_ADDRSTRLEN);
inet_ntop (AF_INET6, netload.address6, address6_string, INET6_ADDRSTRLEN);
inet_ntop (AF_INET6, netload.prefix6, prefix6_string, INET6_ADDRSTRLEN);
@@ -153,9 +152,6 @@ main (int argc, char *argv [])
hwaddress_string);
- g_free (address_string);
- g_free (subnet_string);
-
glibtop_close ();
exit (0);
diff --git a/src/daemon/gnuserv.c b/src/daemon/gnuserv.c
index 78ebb643..26e9dd92 100644
--- a/src/daemon/gnuserv.c
+++ b/src/daemon/gnuserv.c
@@ -392,6 +392,7 @@ handle_internet_request (int ls)
int s;
size_t addrlen = sizeof (struct sockaddr_in);
struct sockaddr_in peer; /* for peer socket address */
+ char addrstr[addrlen];
pid_t pid;
memset ((char *) &peer, 0, sizeof (struct sockaddr_in));
@@ -401,21 +402,24 @@ handle_internet_request (int ls)
exit (1);
}
+ /* TODO: Check errno. */
+ inet_ntop (AF_INET, &peer, addrstr, addrlen);
+
if (verbose_output)
syslog_message (LOG_INFO, "Connection was made from %s port %u.",
- inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
+ addrstr, ntohs (peer.sin_port));
/* Check that access is allowed - if not return crud to the client */
if (!permitted (peer.sin_addr.s_addr, s)) {
close (s);
syslog_message (LOG_CRIT, "Refused connection from %s.",
- inet_ntoa (peer.sin_addr));
+ addrstr);
return;
} /* if */
if (verbose_output)
syslog_message (LOG_INFO, "Accepted connection from %s port %u.",
- inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
+ addrstr, ntohs (peer.sin_port));
pid = fork ();
@@ -436,7 +440,7 @@ handle_internet_request (int ls)
if (verbose_output)
syslog_message (LOG_INFO, "Closed connection to %s port %u.",
- inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
+ addrstr, ntohs (peer.sin_port));
_exit (0);
} /* handle_internet_request */
@@ -560,6 +564,7 @@ main (int argc, char **argv)
if (invoked_from_inetd) {
size_t addrlen = sizeof (struct sockaddr_in);
struct sockaddr_in peer;
+ char addrstr[addrlen];
memset ((char *) &peer, 0, sizeof (struct sockaddr_in));
@@ -568,15 +573,18 @@ main (int argc, char **argv)
exit (1);
}
+ /* TODO: Check errno. */
+ inet_ntop (AF_INET, &peer, addrstr, addrlen);
+
if (verbose_output)
syslog_message (LOG_INFO, "Connection was made from %s port %u.",
- inet_ntoa (peer.sin_addr), ntohs (peer.sin_port));
+ addrstr, ntohs (peer.sin_port));
/* Check that access is allowed - if not return crud to the client */
if (!permitted (peer.sin_addr.s_addr, 0)) {
close (0);
syslog_message (LOG_CRIT, "Refused connection from %s.",
- inet_ntoa (peer.sin_addr));
+ addrstr);
exit (1);
}
diff --git a/sysdeps/common/gnuslib.c b/sysdeps/common/gnuslib.c
index 79295485..3f994f2c 100644
--- a/sysdeps/common/gnuslib.c
+++ b/sysdeps/common/gnuslib.c
@@ -202,16 +202,20 @@ connect_to_unix_server (void)
long
glibtop_internet_addr (const char *host)
{
- struct hostent *hp; /* pointer to host info for remote host */
+ /* specify IPv4 and TCP */
+ struct addrinfo hints = { AF_INET, SOCK_STREAM, };
+ struct addrinfo *result;/* pointer to host info for remote host */
IN_ADDR numeric_addr; /* host address */
- numeric_addr = inet_addr (host);
- if (!NUMERIC_ADDR_ERROR)
+ if (getaddrinfo (NULL, host, &hints, &result) == 0) {
+ /* Take only the first address. */
+ struct sockaddr_in *res = (struct sockaddr_in *)result->ai_addr;
+ numeric_addr = res->sin_addr.s_addr;
+ freeaddrinfo (result);
return numeric_addr;
- else if ((hp = gethostbyname (host)) != NULL)
- return ((struct in_addr *) (hp->h_addr))->s_addr;
+ }
else {
- glibtop_warn_io ("gethostbyname (%s)", host);
+ glibtop_warn_io ("getaddrinfo (%s)", host);
return -1;
}
--
2.36.1

@ -1,18 +1,15 @@
Name: libgtop2
Version: 2.40.0
Release: 9%{?dist}
Version: 2.38.0
Release: 3%{?dist}
Summary: LibGTop library (version 2)
License: GPLv2+
URL: http://download.gnome.org/sources/libgtop
Source0: http://download.gnome.org/sources/libgtop/2.40/libgtop-%{version}.tar.xz
# https://bugzilla.redhat.com/show_bug.cgi?id=2050712
Patch0: libgtop2-2.40.0-deprecated-networking.patch
Source0: http://download.gnome.org/sources/libgtop/2.38/libgtop-%{version}.tar.xz
BuildRequires: pkgconfig(gobject-2.0)
BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: gettext
BuildRequires: make
%description
LibGTop is a library for portably obtaining information about processes,
@ -27,11 +24,11 @@ This package provides the necessary development libraries and include
files to allow you to develop with LibGTop.
%prep
%autosetup -p1 -n libgtop-%{version}
%setup -q -n libgtop-%{version}
%build
%configure --disable-gtk-doc --disable-static
%make_build
make %{?_smp_mflags}
%install
%make_install
@ -45,8 +42,6 @@ find %{buildroot} -name '*.la' -delete
%files -f libgtop.lang
%doc AUTHORS NEWS README
%license COPYING
%{_bindir}/libgtop_daemon2
%{_bindir}/libgtop_server2
%{_libdir}/libgtop-2.0.so.11*
%dir %{_libdir}/girepository-1.0
%{_libdir}/girepository-1.0/GTop-2.0.typelib
@ -54,7 +49,7 @@ find %{buildroot} -name '*.la' -delete
%files devel
%{_libdir}/libgtop-2.0.so
%{_includedir}/libgtop-2.0
%{_libdir}/pkgconfig/libgtop-2.0.pc
%{_libdir}/pkgconfig/*.pc
%dir %{_datadir}/gir-1.0
%{_datadir}/gir-1.0/GTop-2.0.gir
%dir %{_datadir}/gtk-doc
@ -64,47 +59,6 @@ find %{buildroot} -name '*.la' -delete
%exclude %{_datadir}/info
%changelog
* Tue Jun 07 2022 David King <amigadave@amigadave.com> - 2.40.0-9
- Avoid use of deprecated networking functions (#2050712)
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 2.40.0-8
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.40.0-7
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.40.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.40.0-5
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.40.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.40.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.40.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Mar 11 2019 Kalev Lember <klember@redhat.com> - 2.40.0-1
- Update to 2.40.0
* Mon Feb 18 2019 Kalev Lember <klember@redhat.com> - 2.39.91-1
- Update to 2.39.91
* Mon Feb 04 2019 Kalev Lember <klember@redhat.com> - 2.39.90-1
- Update to 2.39.90
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.38.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.38.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.38.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

Loading…
Cancel
Save