+2006-04-27 Ulrich Drepper <drepper@redhat.com>
+
+ * nscd/connections.c (restart): If we want to switch back to the
+ old ID use setresuid and setresgid.
+ (finish_drop_privileges): Likewise.
+
2006-04-27 Jakub Jelinek <jakub@redhat.com>
* nscd/nscd.conf: Fix a typo.
/* 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"),
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"),
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");