aboutsummaryrefslogtreecommitdiffstats
path: root/guts/setgid.c
diff options
context:
space:
mode:
Diffstat (limited to 'guts/setgid.c')
-rw-r--r--guts/setgid.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/guts/setgid.c b/guts/setgid.c
new file mode 100644
index 0000000..0bb5f27
--- /dev/null
+++ b/guts/setgid.c
@@ -0,0 +1,24 @@
+/*
+ * static int
+ * wrap_setgid(gid_t gid) {
+ * int rc = -1;
+ */
+ if (pseudo_euid == 0) {
+ pseudo_rgid = gid;
+ pseudo_egid = gid;
+ pseudo_sgid = gid;
+ pseudo_fgid = gid;
+ pseudo_client_touchgid();
+ rc = 0;
+ } else if (pseudo_egid == gid || pseudo_sgid == gid || pseudo_rgid == gid) {
+ pseudo_egid = gid;
+ pseudo_fgid = gid;
+ pseudo_client_touchgid();
+ rc = 0;
+ } else {
+ rc = -1;
+ errno = EPERM;
+ }
+/* return rc;
+ * }
+ */