From 3acf8e092f95233bc3d854e161569487dce83ba2 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 3 Feb 2017 14:22:03 +1100 Subject: [PATCH] 4567. [port] Call getprotobyname and getservbyname prior to calling chroot so that shared libraries get loaded. [RT #44537] --- lib/isc/unix/dir.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/isc/unix/dir.c b/lib/isc/unix/dir.c index 0d64778..ee80f41 100644 --- a/lib/isc/unix/dir.c +++ b/lib/isc/unix/dir.c @@ -31,6 +31,7 @@ #include #include +#include #include #include @@ -172,6 +173,15 @@ 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. + */ + if (getprotobyname("udp")) + (void)getservbyname("domain", "udp"); + if (chroot(dirname) < 0 || chdir("/") < 0) return (isc__errno2result(errno)); -- 2.9.3