diff options
author | Andreas Schneider <asn@samba.org> | 2011-10-06 16:25:32 +0200 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2011-10-07 10:24:03 +0200 |
commit | c2b9e9b0eab3b10e36a56835602e7c931c406b12 (patch) | |
tree | da382c464432948e6883289a24e08a6e769049f0 | |
parent | 556ef6ac906ef6155c21714aaa6f3cf3ee52a9ac (diff) | |
download | samba-c2b9e9b0eab3b10e36a56835602e7c931c406b12.tar.gz samba-c2b9e9b0eab3b10e36a56835602e7c931c406b12.tar.bz2 samba-c2b9e9b0eab3b10e36a56835602e7c931c406b12.zip |
uid_wrapper: Add uwrap_setreuid().
-rw-r--r-- | lib/uid_wrapper/uid_wrapper.c | 11 | ||||
-rw-r--r-- | lib/uid_wrapper/uid_wrapper.h | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/uid_wrapper/uid_wrapper.c b/lib/uid_wrapper/uid_wrapper.c index 05d226b034..091678f27b 100644 --- a/lib/uid_wrapper/uid_wrapper.c +++ b/lib/uid_wrapper/uid_wrapper.c @@ -73,6 +73,17 @@ _PUBLIC_ int uwrap_seteuid(uid_t euid) return 0; } +_PUBLIC_ int uwrap_setreuid(uid_t ruid, uid_t euid) +{ + uwrap_init(); + if (!uwrap.enabled) { + return setreuid(ruid, euid); + } + /* 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 b3b11d954a..c0aebcfafc 100644 --- a/lib/uid_wrapper/uid_wrapper.h +++ b/lib/uid_wrapper/uid_wrapper.h @@ -21,6 +21,7 @@ int uwrap_enabled(void); 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); uid_t uwrap_getegid(void); @@ -34,6 +35,11 @@ gid_t uwrap_getgid(void); #endif #define seteuid uwrap_seteuid +#ifdef setreuid +#undef setreuid +#endif +#define setreuid uwrap_setreuid + #ifdef setegid #undef setegid #endif |