From b197a7ed3cd9b5ae6aec7dfbea706bdf4ccfced7 Mon Sep 17 00:00:00 2001 From: Eytan Heidingsfeld <{ID}+{username}@users.noreply.github.com> Date: Tue, 26 Mar 2019 21:09:54 +0000 Subject: Fix issue where sgid is set and gid-offset is used --- src/usermap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/usermap.c') diff --git a/src/usermap.c b/src/usermap.c index f745e74..a85b597 100644 --- a/src/usermap.c +++ b/src/usermap.c @@ -99,6 +99,7 @@ const char* usermap_errorstr(UsermapStatus status) uid_t usermap_get_uid_or_default(UserMap *map, uid_t u, uid_t deflt) { int i; + if (u == -1) return -1; for (i = 0; i < map->user_size; ++i) { if (map->user_from[i] == u) { return map->user_to[i]; @@ -110,6 +111,7 @@ uid_t usermap_get_uid_or_default(UserMap *map, uid_t u, uid_t deflt) gid_t usermap_get_gid_or_default(UserMap *map, gid_t g, gid_t deflt) { int i; + if (g == -1) return -1; for (i = 0; i < map->group_size; ++i) { if (map->group_from[i] == g) { return map->group_to[i]; -- cgit v1.2.3