aboutsummaryrefslogtreecommitdiffstats
path: root/guts/setresgid.c
diff options
context:
space:
mode:
Diffstat (limited to 'guts/setresgid.c')
-rw-r--r--guts/setresgid.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/guts/setresgid.c b/guts/setresgid.c
new file mode 100644
index 0000000..455fe62
--- /dev/null
+++ b/guts/setresgid.c
@@ -0,0 +1,34 @@
+/*
+ * static int
+ * wrap_setresgid(gid_t rgid, gid_t egid, gid_t sgid) {
+ * int rc = -1;
+ */
+ rc = 0;
+ if (pseudo_euid != 0 && rgid != -1 &&
+ rgid != pseudo_egid && rgid != pseudo_rgid && rgid != pseudo_sgid) {
+ rc = -1;
+ errno = EPERM;
+ }
+ if (pseudo_euid != 0 && egid != -1 &&
+ egid != pseudo_egid && egid != pseudo_rgid && egid != pseudo_sgid) {
+ rc = -1;
+ errno = EPERM;
+ }
+ if (pseudo_euid != 0 && sgid != -1 &&
+ sgid != pseudo_egid && sgid != pseudo_rgid && sgid != pseudo_sgid) {
+ rc = -1;
+ errno = EPERM;
+ }
+ if (rc != -1) {
+ if (rgid != -1)
+ pseudo_rgid = rgid;
+ if (egid != -1)
+ pseudo_egid = egid;
+ if (sgid != -1)
+ pseudo_sgid = sgid;
+ pseudo_fgid = pseudo_egid;
+ pseudo_client_touchuid();
+ }
+/* return rc;
+ * }
+ */