jail: include /etc/nsswitch.conf in jail for glibc.
authorDaniel Golle <daniel@makrotopia.org>
Sun, 19 Apr 2020 22:06:51 +0000 (23:06 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Sun, 19 Apr 2020 22:13:23 +0000 (23:13 +0100)
/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 <tobias.waldvogel@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
jail/jail.c

index ca8b832ea219880f40f8076c8286cc103727e896..5a1c05b939729b42ea00213bfb17ae6f0842ce61 100644 (file)
@@ -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);
                        }