]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
4567. [port] Call getprotobyname and getservbyname prior to calling
authorMark Andrews <marka@isc.org>
Fri, 3 Feb 2017 03:22:03 +0000 (14:22 +1100)
committerMark Andrews <marka@isc.org>
Fri, 3 Feb 2017 03:23:45 +0000 (14:23 +1100)
                        chroot so that shared libraries get loaded. [RT #44537]

(cherry picked from commit c550e75ade4ceb4ece96f660292799519a5c3183)

CHANGES
lib/isc/unix/dir.c

diff --git a/CHANGES b/CHANGES
index 3b665845c60dc076e5c78b2bd78365ad41c94c78..4610116f1bbf30b774781429c80660764a4be1ec 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4567.  [port]          Call getprotobyname and getservbyname prior to calling
+                       chroot so that shared libraries get loaded. [RT #44537]
+
 4564.  [maint]         Update the built in managed keys to include the
                        upcoming root KSK. [RT #44579]
 
index 0d647782a1d9a99f598230c2109c09500d489b63..66c8d565c3b6c5dde0108eff5b426a22edbc0e8c 100644 (file)
@@ -31,6 +31,7 @@
 
 #include <isc/dir.h>
 #include <isc/magic.h>
+#include <isc/netdb.h>
 #include <isc/string.h>
 #include <isc/util.h>
 
@@ -172,6 +173,14 @@ isc_dir_chroot(const char *dirname) {
        REQUIRE(dirname != NULL);
 
 #ifdef HAVE_CHROOT
+       /*
+        * Try to use getservbyname and getprotobyname before chroot.
+        * If WKS records are used in a zone under chroot, Name Service Switch
+        * may fail to load library in chroot.
+        * Do not report errors if it fails, we do not need any result now.
+        */
+       getprotobyname("udp") && getservbyname("domain", "udp");
+
        if (chroot(dirname) < 0 || chdir("/") < 0)
                return (isc__errno2result(errno));