summaryrefslogtreecommitdiff
path: root/lib/uid_wrapper
diff options
context:
space:
mode:
Diffstat (limited to 'lib/uid_wrapper')
-rw-r--r--lib/uid_wrapper/uid_wrapper.c11
-rw-r--r--lib/uid_wrapper/uid_wrapper.h6
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/uid_wrapper/uid_wrapper.c b/lib/uid_wrapper/uid_wrapper.c
index 091678f27b..07ab6da7c7 100644
--- a/lib/uid_wrapper/uid_wrapper.c
+++ b/lib/uid_wrapper/uid_wrapper.c
@@ -104,6 +104,17 @@ _PUBLIC_ int uwrap_setegid(gid_t egid)
return 0;
}
+_PUBLIC_ int uwrap_setregid(gid_t rgid, gid_t egid)
+{
+ uwrap_init();
+ if (!uwrap.enabled) {
+ return setregid(rgid, egid);
+ }
+ /* assume for now that the ruid stays as root */
+ uwrap.egid = egid;
+ return 0;
+}
+
_PUBLIC_ uid_t uwrap_getegid(void)
{
uwrap_init();
diff --git a/lib/uid_wrapper/uid_wrapper.h b/lib/uid_wrapper/uid_wrapper.h
index c0aebcfafc..78b6c388ed 100644
--- a/lib/uid_wrapper/uid_wrapper.h
+++ b/lib/uid_wrapper/uid_wrapper.h
@@ -24,6 +24,7 @@ int uwrap_seteuid(uid_t euid);
int uwrap_setreuid(uid_t reuid, uid_t euid);
uid_t uwrap_geteuid(void);
int uwrap_setegid(gid_t egid);
+int uwrap_setregid(gid_t egid);
uid_t uwrap_getegid(void);
int uwrap_setgroups(size_t size, const gid_t *list);
int uwrap_getgroups(int size, gid_t *list);
@@ -45,6 +46,11 @@ gid_t uwrap_getgid(void);
#endif
#define setegid uwrap_setegid
+#ifdef setregid
+#undef setregid
+#endif
+#define setregid uwrap_setegid
+
#ifdef geteuid
#undef geteuid
#endif