[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH 3/3] lib/posix-user: Implement getresgid() and setresgid()



We accept a single group ID.

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 lib/posix-user/user.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/posix-user/user.c b/lib/posix-user/user.c
index 5e2fc9f3..2c287297 100644
--- a/lib/posix-user/user.c
+++ b/lib/posix-user/user.c
@@ -205,8 +205,27 @@ int setegid(gid_t egid __unused)
        return 0;
 }
 
-int getresgid(gid_t *rgid __unused, gid_t *egid __unused, gid_t *sgid __unused)
+int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid)
 {
+       if (!rgid || !egid || !sgid) {
+               errno = EFAULT;
+               return -1;
+       }
+
+       rgid = egid = sgid = UK_DEFAULT_GID;
+
+       return 0;
+}
+
+int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
+{
+       /* We allow only UK_DEFAULT_GID */
+       if (rgid != UK_DEFAULT_GID || egid != UK_DEFAULT_GID ||
+                       sgid != UK_DEFAULT_GID) {
+               errno = EINVAL;
+               return -1;
+       }
+
        return 0;
 }
 
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.