diff options
author | Jeremy Allison <jra@samba.org> | 2012-06-28 11:59:51 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-06-28 17:15:16 -0700 |
commit | 821bd95156e8cc6d843aecb0a27d4a08761b7dac (patch) | |
tree | a35f1f0059005555bc3fe548760a9cf01e896d55 /lib/uid_wrapper | |
parent | 7630fe50bd7d0783d1f6b253cbee46cccca3f774 (diff) | |
download | samba-821bd95156e8cc6d843aecb0a27d4a08761b7dac.tar.gz samba-821bd95156e8cc6d843aecb0a27d4a08761b7dac.tar.bz2 samba-821bd95156e8cc6d843aecb0a27d4a08761b7dac.zip |
Replace all uses of setXX[ug]id() and setgroups with samba_setXX[ug]id() calls.
Will allow thread-specific credentials to be added by modifying
the central definitions. Deliberately left the setXX[ug]id()
call in popt as this is not used in Samba.
Diffstat (limited to 'lib/uid_wrapper')
-rw-r--r-- | lib/uid_wrapper/uid_wrapper.c | 15 | ||||
-rw-r--r-- | lib/uid_wrapper/uid_wrapper.h | 42 | ||||
-rw-r--r-- | lib/uid_wrapper/wscript_build | 2 |
3 files changed, 30 insertions, 29 deletions
diff --git a/lib/uid_wrapper/uid_wrapper.c b/lib/uid_wrapper/uid_wrapper.c index 898d1afbb9..7a85a9563a 100644 --- a/lib/uid_wrapper/uid_wrapper.c +++ b/lib/uid_wrapper/uid_wrapper.c @@ -22,6 +22,7 @@ #include "replace.h" #include "system/passwd.h" #include <talloc.h> +#include "../lib/util/setid.h" #else /* _SAMBA_BUILD_ */ @@ -72,7 +73,7 @@ _PUBLIC_ int uwrap_seteuid(uid_t euid) { uwrap_init(); if (!uwrap.enabled) { - return seteuid(euid); + return samba_seteuid(euid); } /* assume for now that the ruid stays as root */ if (euid == 0) { @@ -89,7 +90,7 @@ _PUBLIC_ int uwrap_setreuid(uid_t ruid, uid_t euid) { uwrap_init(); if (!uwrap.enabled) { - return setreuid(ruid, euid); + return samba_setreuid(ruid, euid); } /* assume for now that the ruid stays as root */ if (euid == 0) { @@ -106,7 +107,7 @@ _PUBLIC_ int uwrap_setresuid(uid_t ruid, uid_t euid, uid_t suid) { uwrap_init(); if (!uwrap.enabled) { - return setresuid(ruid, euid, suid); + return samba_setresuid(ruid, euid, suid); } /* assume for now that the ruid stays as root */ if (euid == 0) { @@ -132,7 +133,7 @@ _PUBLIC_ int uwrap_setegid(gid_t egid) { uwrap_init(); if (!uwrap.enabled) { - return setegid(egid); + return samba_setegid(egid); } /* assume for now that the ruid stays as root */ if (egid == 0) { @@ -149,7 +150,7 @@ _PUBLIC_ int uwrap_setregid(gid_t rgid, gid_t egid) { uwrap_init(); if (!uwrap.enabled) { - return setregid(rgid, egid); + return samba_setregid(rgid, egid); } /* assume for now that the ruid stays as root */ if (egid == 0) { @@ -166,7 +167,7 @@ _PUBLIC_ int uwrap_setresgid(gid_t rgid, gid_t egid, gid_t sgid) { uwrap_init(); if (!uwrap.enabled) { - return setresgid(rgid, egid, sgid); + return samba_setresgid(rgid, egid, sgid); } /* assume for now that the ruid stays as root */ if (egid == 0) { @@ -191,7 +192,7 @@ _PUBLIC_ int uwrap_setgroups(size_t size, const gid_t *list) { uwrap_init(); if (!uwrap.enabled) { - return setgroups(size, list); + return samba_setgroups(size, list); } talloc_free(uwrap.groups); diff --git a/lib/uid_wrapper/uid_wrapper.h b/lib/uid_wrapper/uid_wrapper.h index c59749379a..21d0795d41 100644 --- a/lib/uid_wrapper/uid_wrapper.h +++ b/lib/uid_wrapper/uid_wrapper.h @@ -36,35 +36,35 @@ gid_t uwrap_getgid(void); #ifdef UID_WRAPPER_REPLACE -#ifdef seteuid -#undef seteuid +#ifdef samba_seteuid +#undef samba_seteuid #endif -#define seteuid uwrap_seteuid +#define samba_seteuid uwrap_seteuid -#ifdef setreuid -#undef setreuid +#ifdef samba_setreuid +#undef samba_setreuid #endif -#define setreuid uwrap_setreuid +#define samba_setreuid uwrap_setreuid -#ifdef setresuid -#undef setresuid +#ifdef samba_setresuid +#undef samba_setresuid #endif -#define setresuid uwrap_setresuid +#define samba_setresuid uwrap_setresuid -#ifdef setegid -#undef setegid +#ifdef samba_setegid +#undef samba_setegid #endif -#define setegid uwrap_setegid +#define samba_setegid uwrap_setegid -#ifdef setregid -#undef setregid +#ifdef samba_setregid +#undef samba_setregid #endif -#define setregid uwrap_setregid +#define samba_setregid uwrap_setregid -#ifdef setresgid -#undef setresgid +#ifdef samba_setresgid +#undef samba_setresgid #endif -#define setresgid uwrap_setresgid +#define samba_setresgid uwrap_setresgid #ifdef geteuid #undef geteuid @@ -76,10 +76,10 @@ gid_t uwrap_getgid(void); #endif #define getegid uwrap_getegid -#ifdef setgroups -#undef setgroups +#ifdef samba_setgroups +#undef samba_setgroups #endif -#define setgroups uwrap_setgroups +#define samba_setgroups uwrap_setgroups #ifdef getgroups #undef getgroups diff --git a/lib/uid_wrapper/wscript_build b/lib/uid_wrapper/wscript_build index 54e5b80f43..76d4b17fce 100644 --- a/lib/uid_wrapper/wscript_build +++ b/lib/uid_wrapper/wscript_build @@ -3,7 +3,7 @@ bld.SAMBA_LIBRARY('uid_wrapper', source='uid_wrapper.c', - deps='talloc', + deps='talloc util_setid', private_library=True, enabled=bld.CONFIG_SET("UID_WRAPPER"), ) |