From d200b70e5d5b0b3b61e2573f1c2fa22b3fa9d63a Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sun, 19 Apr 2020 23:06:51 +0100 Subject: [PATCH] jail: include /etc/nsswitch.conf in jail for glibc. /etc/nsswitch.conf is needed to resolve usernames and groups from /etc/passwd and /etc/groups, name resoultion and a bunch of other things when using glibc. Mount /etc/nsswitch.conf in jail when building against glibc. Reported-by: Tobias Waldvogel Signed-off-by: Daniel Golle --- jail/jail.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jail/jail.c b/jail/jail.c index ca8b832..5a1c05b 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -790,6 +790,11 @@ int main(int argc, char **argv) add_mount("/etc/group", 0, -1); } +#if defined(__GLIBC__) + if (!opts.extroot) + add_mount("/etc/nsswitch.conf", 0, -1); +#endif + if (!(opts.namespace & CLONE_NEWNET)) { add_mount("/etc/resolv.conf", 0, -1); } -- 2.30.2