diff options
-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 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 |