]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
jail: Add exception for root user when reading subuid/subgid
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 6 Dec 2022 12:28:09 +0000 (12:28 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 6 Dec 2022 12:28:09 +0000 (12:28 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/pwd.c

index 756339d0bfa0a7089903adbf9aff5e623793ad15..a835bd4a05d100c2d2476c23ad12c8bb8d073724 100644 (file)
@@ -231,6 +231,14 @@ int pakfire_getsubid(struct pakfire* pakfire, const char* path, const uid_t uid,
        struct pakfire_subid* entry = NULL;
        int r = 1;
 
+       // Do not lookup root user and set the entire available UID/GID range
+       if (uid == 0) {
+               subid->id     = 0;
+               subid->length = 0xffffffff - 1;
+
+               return 0;
+       }
+
        // Fetch information about the running user
        struct passwd* passwd = getpwuid(uid);
        if (!passwd) {