summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2011-10-07 10:30:23 +0200
committerAndreas Schneider <asn@cryptomilk.org>2011-10-07 12:04:04 +0200
commit4493c578b0da44ae2100cc0d4d6acc714bf39a3f (patch)
tree43993c9b23d6b5ad2901139f4c04a3308f9c4819 /lib
parent17f1276feadae1cfeea559e46e44ad136c438251 (diff)
downloadsamba-4493c578b0da44ae2100cc0d4d6acc714bf39a3f.tar.gz
samba-4493c578b0da44ae2100cc0d4d6acc714bf39a3f.tar.bz2
samba-4493c578b0da44ae2100cc0d4d6acc714bf39a3f.zip
uid_wrapper: Add uwrap_setresuid().
Autobuild-User: Andreas Schneider <asn@cryptomilk.org> Autobuild-Date: Fri Oct 7 12:04:05 CEST 2011 on sn-devel-104
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 07ab6da7c7..8229fbbd58 100644
--- a/lib/uid_wrapper/uid_wrapper.c
+++ b/lib/uid_wrapper/uid_wrapper.c
@@ -84,6 +84,17 @@ _PUBLIC_ int uwrap_setreuid(uid_t ruid, uid_t euid)
return 0;
}
+_PUBLIC_ int uwrap_setresuid(uid_t ruid, uid_t euid, uid_t suid)
+{
+ uwrap_init();
+ if (!uwrap.enabled) {
+ return setresuid(ruid, euid, suid);
+ }
+ /* assume for now that the ruid stays as root */
+ uwrap.euid = euid;
+ return 0;
+}
+
_PUBLIC_ uid_t uwrap_geteuid(void)
{
uwrap_init();
diff --git a/lib/uid_wrapper/uid_wrapper.h b/lib/uid_wrapper/uid_wrapper.h
index 78b6c388ed..51a11c57f2 100644
--- a/lib/uid_wrapper/uid_wrapper.h
+++ b/lib/uid_wrapper/uid_wrapper.h
@@ -22,6 +22,7 @@
int uwrap_enabled(void);
int uwrap_seteuid(uid_t euid);
int uwrap_setreuid(uid_t reuid, uid_t euid);
+int uwrap_setresuid(uid_t reuid, uid_t euid, uid_t suid);
uid_t uwrap_geteuid(void);
int uwrap_setegid(gid_t egid);
int uwrap_setregid(gid_t egid);
@@ -41,6 +42,11 @@ gid_t uwrap_getgid(void);
#endif
#define setreuid uwrap_setreuid
+#ifdef setresuid
+#undef setresuid
+#endif
+#define setresuid uwrap_setresuid
+
#ifdef setegid
#undef setegid
#endif