aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2022-02-11 13:06:01 +0100
committerKarel Kočí <cynerd@email.cz>2022-02-11 13:06:01 +0100
commitdb9e7c9a30e9430119efb34ca9b5324314e6b4a8 (patch)
tree5a8d1978e779ff6b6b473efc0081eaf93b8961dd /main.c
parent8d61610974c4e60510358ce1bdb22c1042c465a9 (diff)
downloaduroot-db9e7c9a30e9430119efb34ca9b5324314e6b4a8.tar.gz
uroot-db9e7c9a30e9430119efb34ca9b5324314e6b4a8.tar.bz2
uroot-db9e7c9a30e9430119efb34ca9b5324314e6b4a8.zip
Read subuid and subgid files instead of hard coded values
This implements reading of /etc/subuid and /etc/subgid files to correctly map user and group IDs. It also allows just mapping the user itself if there is no mapping configured.
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index 058aa3b..9ffaf6a 100644
--- a/main.c
+++ b/main.c
@@ -107,9 +107,9 @@ int main(int argc, char **argv) {
&chargs);
#define FAIL(MSG) do { fputs(MSG, stderr); kill(chpid, SIGKILL); return 1; } while (false);
- if (new_map_id("uid", chpid, getuid()))
+ if (new_map_id(MAP_ID_USER, chpid, getuid()))
FAIL("Mapping of uid failed!\n");
- if (new_map_id("gid", chpid, getgid()))
+ if (new_map_id(MAP_ID_GROUP, chpid, getgid()))
FAIL("Mapping of gid failed!\n");
sigpipe_signal(chargs.sigpipe);