From 119d04f017c39307280bb88fcdeaaf6f31ee9c9d Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Fri, 19 Jan 2024 13:08:41 +0100 Subject: add convenience function unshare_user_idmap_nohelper --- tests/test_simple.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/test_simple.py b/tests/test_simple.py index e0cb66e..8469bb4 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -84,15 +84,12 @@ class UnshareTest(unittest.TestCase): @pytest.mark.forked def test_populate_dev(self) -> None: - uidmap = linuxnamespaces.IDMapping(0, os.getuid(), 1) - gidmap = linuxnamespaces.IDMapping(0, os.getgid(), 1) - linuxnamespaces.unshare( + linuxnamespaces.unshare_user_idmap_nohelper( + 0, + 0, linuxnamespaces.CloneFlags.NEWUSER - | linuxnamespaces.CloneFlags.NEWNS + | linuxnamespaces.CloneFlags.NEWNS, ) - pathlib.Path("/proc/self/setgroups").write_text("deny") - linuxnamespaces.newuidmap(-1, [uidmap], False) - linuxnamespaces.newgidmap(-1, [gidmap], False) linuxnamespaces.mount("tmpfs", "/mnt", "tmpfs", data="mode=0755") os.mkdir("/mnt/dev") linuxnamespaces.populate_dev("/", "/mnt", pidns=False) -- cgit v1.2.3