Blame SOURCES/bind99-rh1392362.patch

900526
From 3acf8e092f95233bc3d854e161569487dce83ba2 Mon Sep 17 00:00:00 2001
900526
From: Mark Andrews <marka@isc.org>
900526
Date: Fri, 3 Feb 2017 14:22:03 +1100
900526
Subject: [PATCH] 4567. [port] Call getprotobyname and getservbyname prior to
900526
 calling chroot so that shared libraries get loaded. [RT #44537]
900526
900526
---
900526
 lib/isc/unix/dir.c | 10 ++++++++++
900526
 1 file changed, 10 insertions(+)
900526
900526
diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c
900526
index 0d64778..ee80f41 100644
900526
--- a/lib/isc/unix/dir.c
900526
+++ b/lib/isc/unix/dir.c
900526
@@ -31,6 +31,7 @@
900526
 
900526
 #include <isc/dir.h>
900526
 #include <isc/magic.h>
900526
+#include <isc/netdb.h>
900526
 #include <isc/string.h>
900526
 #include <isc/util.h>
900526
 
900526
@@ -172,6 +173,15 @@ isc_dir_chroot(const char *dirname) {
900526
 	REQUIRE(dirname != NULL);
900526
 
900526
 #ifdef HAVE_CHROOT
900526
+	/*
900526
+	 * Try to use getservbyname and getprotobyname before chroot.
900526
+	 * If WKS records are used in a zone under chroot, Name Service Switch
900526
+	 * may fail to load library in chroot.
900526
+	 * Do not report errors if it fails, we do not need any result now.
900526
+	 */
900526
+	if (getprotobyname("udp"))
900526
+		(void)getservbyname("domain", "udp");
900526
+
900526
 	if (chroot(dirname) < 0 || chdir("/") < 0)
900526
 		return (isc__errno2result(errno));
900526
 
900526
-- 
900526
2.9.3
900526