summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-10-06 16:52:03 +0200
committerAndreas Schneider <asn@samba.org>2011-10-07 10:24:08 +0200
commit17f1276feadae1cfeea559e46e44ad136c438251 (patch)
tree66bf95a696b10826d9ceb1dd2ca419512c7a9dfd /lib
parentc2b9e9b0eab3b10e36a56835602e7c931c406b12 (diff)
downloadsamba-17f1276feadae1cfeea559e46e44ad136c438251.tar.gz
samba-17f1276feadae1cfeea559e46e44ad136c438251.tar.bz2
samba-17f1276feadae1cfeea559e46e44ad136c438251.zip
uid_wrapper: Add uwrap_setregid().
Diffstat (limited to 'lib')
-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