aboutsummaryrefslogtreecommitdiff
path: root/nix/nix-daemon
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-12-09 18:11:14 +0100
committerLudovic Courtès <ludo@gnu.org>2016-12-09 18:11:14 +0100
commitf80b4d2ce09b0b7770cbdf2f90704d41b0a168c5 (patch)
treeec47c7ee5d5579cfa00f13b5038ff3d8c87e4a48 /nix/nix-daemon
parent13b5f44b475aa385d580f7e19b907210bc1d6d99 (diff)
parent2608e40988ba8cf51723fe0d21bdedf6b3997c9c (diff)
downloadguix-f80b4d2ce09b0b7770cbdf2f90704d41b0a168c5.tar
guix-f80b4d2ce09b0b7770cbdf2f90704d41b0a168c5.tar.gz
Merge remote-tracking branch 'origin/master' into staging
Diffstat (limited to 'nix/nix-daemon')
-rw-r--r--nix/nix-daemon/nix-daemon.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc
index 682f9a2b5b..47b67d5863 100644
--- a/nix/nix-daemon/nix-daemon.cc
+++ b/nix/nix-daemon/nix-daemon.cc
@@ -960,6 +960,18 @@ static void daemonLoop()
strncpy(argvSaved[1], processName.c_str(), strlen(argvSaved[1]));
}
+#if defined(SO_PEERCRED)
+ /* Store the client's user and group for this connection. This
+ has to be done in the forked process since it is per
+ connection. */
+ settings.clientUid = cred.uid;
+ settings.clientGid = cred.gid;
+#else
+ /* Setting these to -1 means: do not change */
+ settings.clientUid = (uid_t) -1;
+ settings.clientGid = (gid_t) -1;
+#endif
+
/* Handle the connection. */
from.fd = remote;
to.fd = remote;