about summary refs log tree commit diff
path: root/nscd/connections.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-04-27 20:20:52 +0000
committerUlrich Drepper <drepper@redhat.com>2006-04-27 20:20:52 +0000
commit464c9fadafa7e8c30d0e2fd5914e0d6011f1f8ef (patch)
treedff6949000140d7a975e898823c2b48d44a6f5c8 /nscd/connections.c
parenta6375d1104c907dc4a26e780af4207b89f48a0a2 (diff)
downloadglibc-464c9fadafa7e8c30d0e2fd5914e0d6011f1f8ef.tar.gz
glibc-464c9fadafa7e8c30d0e2fd5914e0d6011f1f8ef.tar.xz
glibc-464c9fadafa7e8c30d0e2fd5914e0d6011f1f8ef.zip
* nscd/connections.c (restart): If we want to switch back to the cvs/fedora-glibc-20060427T2122
	old ID use setresuid and setresgid.
	(finish_drop_privileges): Likewise.
Diffstat (limited to 'nscd/connections.c')
-rw-r--r--nscd/connections.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 814d1c7883..0de7945235 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1176,7 +1176,7 @@ cannot open /proc/self/cmdline: %s; disabling paranoia mode"),
   /* Second, change back to the old user if we changed it.  */
   if (server_user != NULL)
     {
-      if (setuid (old_uid) != 0)
+      if (setresuid (old_uid, old_uid, old_uid) != 0)
 	{
 	  dbg_log (_("\
 cannot change to old UID: %s; disabling paranoia mode"),
@@ -1186,7 +1186,7 @@ cannot change to old UID: %s; disabling paranoia mode"),
 	  return;
 	}
 
-      if (setgid (old_gid) != 0)
+      if (setresgid (old_gid, old_gid, old_gid) != 0)
 	{
 	  dbg_log (_("\
 cannot change to old GID: %s; disabling paranoia mode"),
@@ -1873,14 +1873,14 @@ finish_drop_privileges (void)
       error (EXIT_FAILURE, errno, _("setgroups failed"));
     }
 
-  if (setgid (server_gid) == -1)
+  if (setresgid (server_gid, server_gid, old_gid) == -1)
     {
       dbg_log (_("Failed to run nscd as user '%s'"), server_user);
       perror ("setgid");
       exit (4);
     }
 
-  if (setuid (server_uid) == -1)
+  if (setresuid (server_uid, server_uid, old_uid) == -1)
     {
       dbg_log (_("Failed to run nscd as user '%s'"), server_user);
       perror ("setuid");