Fix issue with parsing IPv4 address twice
This commit is contained in:
parent
1e1e50aae2
commit
25af5a1169
34
net-snmp-5.9-twice-IP-parsing.patch
Normal file
34
net-snmp-5.9-twice-IP-parsing.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff --git a/snmplib/transports/snmpUDPDomain.c b/snmplib/transports/snmpUDPDomain.c
|
||||
index b96497f3a..b594a389b 100644
|
||||
--- a/snmplib/transports/snmpUDPDomain.c
|
||||
+++ b/snmplib/transports/snmpUDPDomain.c
|
||||
@@ -387,7 +387,7 @@ netsnmp_udp_parse_security(const char *token, char *param)
|
||||
/* Nope, wasn't a dotted quad. Must be a hostname. */
|
||||
int ret = netsnmp_gethostbyname_v4(sourcep, &network.s_addr);
|
||||
if (ret < 0) {
|
||||
- config_perror("cannot resolve source hostname");
|
||||
+ config_perror("cannot resolve IPv4 source hostname");
|
||||
return;
|
||||
}
|
||||
}
|
||||
diff --git a/snmplib/transports/snmpUDPIPv6Domain.c b/snmplib/transports/snmpUDPIPv6Domain.c
|
||||
index 238c8a9d6..43c4eaee1 100644
|
||||
--- a/snmplib/transports/snmpUDPIPv6Domain.c
|
||||
+++ b/snmplib/transports/snmpUDPIPv6Domain.c
|
||||
@@ -736,7 +736,15 @@ netsnmp_udp6_parse_security(const char *token, char *param)
|
||||
memset(&pton_addr.sin6_addr.s6_addr, '\0',
|
||||
sizeof(struct in6_addr));
|
||||
} else if (inet_pton(AF_INET6, sourcep, &pton_addr.sin6_addr) != 1) {
|
||||
- /* Nope, wasn't a numeric address. Must be a hostname. */
|
||||
+ /* Nope, wasn't a numeric IPv6 address. Must be IPv4 or a hostname. */
|
||||
+
|
||||
+ /* Try interpreting as dotted quad - IPv4 */
|
||||
+ struct in_addr network;
|
||||
+ if (inet_pton(AF_INET, sourcep, &network) > 0){
|
||||
+ /* Yes, it's IPv4 - those it's already parsed and we can return. */
|
||||
+ DEBUGMSGTL(("com2sec6", "IPv4 detected for IPv6 parser. Skipping.\n"));
|
||||
+ return;
|
||||
+ }
|
||||
#if HAVE_GETADDRINFO
|
||||
int gai_error;
|
||||
|
@ -10,7 +10,7 @@
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: 5.9
|
||||
Release: 8%{?dist}
|
||||
Release: 9%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD
|
||||
@ -56,6 +56,7 @@ Patch26: net-snmp-5.8-empty-passphrase.patch
|
||||
Patch27: net-snmp-5.9-ECC-cert.patch
|
||||
Patch28: net-snmp-5.9-intermediate-certs.patch
|
||||
Patch29: net-snmp-5.9-ssl-buffer-size.patch
|
||||
Patch30: net-snmp-5.9-twice-IP-parsing.patch
|
||||
|
||||
# Modern RPM API means at least EL6
|
||||
Patch101: net-snmp-5.8-modern-rpm-api.patch
|
||||
@ -236,6 +237,7 @@ cp %{SOURCE10} .
|
||||
%patch27 -p1 -b .ECC-cert
|
||||
%patch28 -p1 -b .intermediate-certs
|
||||
%patch29 -p1 -b .ssl-buffer-size
|
||||
%patch30 -p1 -b .twice-IP-parsing
|
||||
|
||||
%patch101 -p1 -b .modern-rpm-api
|
||||
%patch102 -p1
|
||||
@ -503,6 +505,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
|
||||
%{_libdir}/libnetsnmptrapd*.so.%{soname}*
|
||||
|
||||
%changelog
|
||||
* Mon Mar 15 2021 Josef Ridky <jridky@redhat.com> - 1:5.9-9
|
||||
- fix issue with parsing IPv4 address twice
|
||||
|
||||
* Tue Mar 02 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1:5.9-8
|
||||
- Rebuilt for updated systemd-rpm-macros
|
||||
See https://pagure.io/fesco/issue/2583.
|
||||
|
Loading…
Reference in New Issue
Block a user