summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-06-28 13:41:19 -0700
committerJeremy Allison <jra@samba.org>2012-06-29 03:57:45 +0200
commit485787f0dfa64bbada7c971ec44f04a1095b4229 (patch)
tree143ec6a9ac9e7d26e90e41f5110791419a9d29ee /source3/lib
parent821bd95156e8cc6d843aecb0a27d4a08761b7dac (diff)
downloadsamba-485787f0dfa64bbada7c971ec44f04a1095b4229.tar.gz
samba-485787f0dfa64bbada7c971ec44f04a1095b4229.tar.bz2
samba-485787f0dfa64bbada7c971ec44f04a1095b4229.zip
Move back to using per-thread credentials on Linux. Fixes the glibc native AIO lost wakeup problem.
See this post: https://lists.samba.org/archive/samba-technical/2012-June/085101.html for details. Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Jun 29 03:57:45 CEST 2012 on sn-devel-104
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util_sec.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source3/lib/util_sec.c b/source3/lib/util_sec.c
index bbb75dbbd4..cee11d9f96 100644
--- a/source3/lib/util_sec.c
+++ b/source3/lib/util_sec.c
@@ -134,7 +134,7 @@ static void assert_gid(gid_t rgid, gid_t egid)
****************************************************************************/
void gain_root_privilege(void)
{
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresuid(0,0,0);
#endif
@@ -164,7 +164,7 @@ void gain_root_privilege(void)
****************************************************************************/
void gain_root_group_privilege(void)
{
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresgid(0,0,0);
#endif
@@ -201,7 +201,7 @@ void gain_root_group_privilege(void)
****************************************************************************/
void set_effective_uid(uid_t uid)
{
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
/* Set the effective as well as the real uid. */
if (samba_setresuid(uid,uid,-1) == -1) {
if (errno == EAGAIN) {
@@ -233,7 +233,7 @@ void set_effective_uid(uid_t uid)
****************************************************************************/
void set_effective_gid(gid_t gid)
{
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresgid(-1,gid,-1);
#endif
@@ -272,7 +272,7 @@ void save_re_uid(void)
void restore_re_uid_fromroot(void)
{
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresuid(saved_ruid, saved_euid, -1);
#elif USE_SETREUID
samba_setreuid(saved_ruid, -1);
@@ -311,7 +311,7 @@ void save_re_gid(void)
****************************************************************************/
void restore_re_gid(void)
{
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresgid(saved_rgid, saved_egid, -1);
#elif USE_SETREUID
samba_setregid(saved_rgid, -1);
@@ -339,7 +339,7 @@ int set_re_uid(void)
{
uid_t uid = geteuid();
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresuid(geteuid(), -1, -1);
#endif
@@ -378,7 +378,7 @@ void become_user_permanently(uid_t uid, gid_t gid)
gain_root_privilege();
gain_root_group_privilege();
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresgid(gid,gid,gid);
samba_setgid(gid);
samba_setresuid(uid,uid,uid);
@@ -422,7 +422,7 @@ static int have_syscall(void)
{
errno = 0;
-#if USE_SETRESUID
+#if defined(USE_SETRESUID) || defined(USE_LINUX_THREAD_CREDENTIALS)
samba_setresuid(-1,-1,-1);
#endif