]> 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:01 +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 791302321a75e0897a9b40214759cad3c00007ac..fa18aabc2505bef129357d1b950e9c4779dd76b6 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]
+
 4565.  [cleanup]       The inline macro versions of isc_buffer_put*()
                        did not implement automatic buffer reallocation.
                        [RT #44216]
index 3fbfcaf4c2b3c49cf47cee6ff6be84e3669c8654..29a587ac2c0aa136faf1bd5327adb1ac78adc8fc 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <isc/dir.h>
 #include <isc/magic.h>
+#include <isc/netdb.h>
 #include <isc/string.h>
 #include <isc/util.h>
 
@@ -163,6 +164,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));