Used gethostbyname2 instead of gethostbyname to fix FTBFS caused by

glibc update dropping support for obsolete RES_USE_INET6
  Resolves: rhbz#1736650
This commit is contained in:
Jaroslav Škarvada 2019-08-02 18:57:18 +02:00
parent e128f2d08a
commit 048b88627e
2 changed files with 49 additions and 2 deletions

View File

@ -0,0 +1,39 @@
diff --git a/libmilter/sm_gethost.c b/libmilter/sm_gethost.c
index a025c8f..cd0ef31 100644
--- a/libmilter/sm_gethost.c
+++ b/libmilter/sm_gethost.c
@@ -49,8 +49,16 @@ sm_getipnodebyname(name, family, flags, err)
int flags;
int *err;
{
- bool resv6 = true;
struct hostent *h;
+# if HAS_GETHOSTBYNAME2
+
+ h = gethostbyname2(name, family);
+ if (h == NULL)
+ *err = h_errno;
+ return h;
+
+# else /* HAS_GETHOSTBYNAME2 */
+ bool resv6 = true;
if (family == AF_INET6)
{
@@ -60,7 +68,7 @@ sm_getipnodebyname(name, family, flags, err)
}
SM_SET_H_ERRNO(0);
h = gethostbyname(name);
- if (family == AF_INET6 && !resv6)
+ if (!resv6)
_res.options &= ~RES_USE_INET6;
/* the function is supposed to return only the requested family */
@@ -75,6 +83,7 @@ sm_getipnodebyname(name, family, flags, err)
else
*err = h_errno;
return h;
+# endif /* HAS_GETHOSTBYNAME2 */
}
void

View File

@ -19,7 +19,7 @@
Summary: A widely used Mail Transport Agent (MTA)
Name: sendmail
Version: 8.15.2
Release: 38%{?dist}
Release: 39%{?dist}
License: Sendmail
URL: http://www.sendmail.org/
@ -92,6 +92,8 @@ Patch28: sendmail-8.15.2-openssl-1.1.0-fix.patch
Patch29: sendmail-8.15.2-format-security.patch
# rhbz#1473971
Patch30: sendmail-8.15.2-openssl-1.1.0-ecdhe-fix.patch
# rhbz#1736650
Patch31: sendmail-8.15.2-gethostbyname2.patch
BuildRequires: libdb-devel
BuildRequires: libnsl2-devel
@ -200,6 +202,7 @@ cp devtools/M4/UNIX/{,shared}library.m4
%patch28 -p1 -b .openssl-1.1.0-fix
%patch29 -p1 -b .format-security
%patch30 -p1 -b .openssl-1.1.0-ecdhe-fix
%patch31 -p1 -b .gethostbyname2
for f in RELEASE_NOTES contrib/etrn.0; do
iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&
@ -213,7 +216,7 @@ sed -i 's|/usr/local/bin/perl|%{_bindir}/perl|' contrib/*.pl
cat > redhat.config.m4 << EOF
define(\`confMAPDEF', \`-DNEWDB -DNIS -DMAP_REGEX -DSOCKETMAP -DNAMED_BIND=1')
define(\`confOPTIMIZE', \`\`\`\`${RPM_OPT_FLAGS}'''')
define(\`confENVDEF', \`-I%{_includedir}/libdb -I%{_prefix}/kerberos/include -Wall -DXDEBUG=0 -DNETINET6 -DHES_GETMAILHOST -DUSE_VENDOR_CF_PATH=1 -D_FFR_LINUX_MHNL -D_FFR_QOS -D_FILE_OFFSET_BITS=64')
define(\`confENVDEF', \`-I%{_includedir}/libdb -I%{_prefix}/kerberos/include -Wall -DXDEBUG=0 -DNETINET6 -DHES_GETMAILHOST -DUSE_VENDOR_CF_PATH=1 -D_FFR_LINUX_MHNL -D_FFR_QOS -D_FILE_OFFSET_BITS=64 -DHAS_GETHOSTBYNAME2')
define(\`confLIBDIRS', \`-L%{_prefix}/kerberos/%{_lib}')
define(\`confLIBS', \`-lnsl -lcrypt -ldb -lresolv')
%{?_hardened_build:define(\`confLDOPTS', \`-Xlinker -z -Xlinker relro -Xlinker -z -Xlinker now')}
@ -702,6 +705,11 @@ exit 0
%changelog
* Fri Aug 2 2019 Jaroslav Škarvada <jskarvad@redhat.com> - 8.15.2-39
- Used gethostbyname2 instead of gethostbyname to fix FTBFS caused by
glibc update dropping support for obsolete RES_USE_INET6
Resolves: rhbz#1736650
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 8.15.2-38
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild