1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-29 13:49:30 +03:00

uid_wrapper: Add uwrap_setreuid().

This commit is contained in:
Andreas Schneider
2011-10-06 16:25:32 +02:00
parent 556ef6ac90
commit c2b9e9b0ea
2 changed files with 17 additions and 0 deletions

View File

@ -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();

View File

@ -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