about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/connections.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 0de7945235..38d5f817fd 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -1873,14 +1873,23 @@ finish_drop_privileges (void)
       error (EXIT_FAILURE, errno, _("setgroups failed"));
     }
 
-  if (setresgid (server_gid, server_gid, old_gid) == -1)
+  int res;
+  if (paranoia)
+    res = setresgid (server_gid, server_gid, old_gid);
+  else
+    res = setgid (server_gid);
+  if (res == -1)
     {
       dbg_log (_("Failed to run nscd as user '%s'"), server_user);
       perror ("setgid");
       exit (4);
     }
 
-  if (setresuid (server_uid, server_uid, old_uid) == -1)
+  if (paranoia)
+    res = setresuid (server_uid, server_uid, old_uid);
+  else
+    res = setuid (server_uid);
+  if (res == -1)
     {
       dbg_log (_("Failed to run nscd as user '%s'"), server_user);
       perror ("setuid");