summaryrefslogtreecommitdiff
path: root/nix/nix-daemon/nix-daemon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'nix/nix-daemon/nix-daemon.cc')
-rw-r--r--nix/nix-daemon/nix-daemon.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 9fff31a587c..f2ffe8fa6f8 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -963,7 +963,10 @@ static void acceptConnection(int fdSocket)
963 clientPid = cred.pid; 963 clientPid = cred.pid;
964 clientUid = cred.uid; 964 clientUid = cred.uid;
965 clientGid = cred.gid; 965 clientGid = cred.gid;
966 trusted = clientUid == 0; 966
967 /* The root user is always trusted; additionally, when running as
968 an unprivileged user, that user is also trusted. */
969 trusted = (clientUid == 0) || (clientUid == getuid());
967 970
968 struct passwd * pw = getpwuid(cred.uid); 971 struct passwd * pw = getpwuid(cred.uid);
969 string user = pw ? pw->pw_name : std::to_string(cred.uid); 972 string user = pw ? pw->pw_name : std::to_string(cred.uid);