summary refs log tree commit diff
path: root/nix/libstore/globals.hh
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2016-11-21 19:49:12 +0100
committerHartmut Goebel <h.goebel@crazy-compilers.com>2016-12-09 15:46:09 +0100
commit2608e40988ba8cf51723fe0d21bdedf6b3997c9c (patch)
treea50081f9bc00670849296fd8f799b9a5c13ba4c9 /nix/libstore/globals.hh
parent43e8824d3cd3ff53671167ab9b41f0094458a4d6 (diff)
downloadguix-2608e40988ba8cf51723fe0d21bdedf6b3997c9c.tar.gz
daemon: Set ownership of kept build directories to the calling user.
Fixes <http://bugs.gnu.org/15890>.

* nix/libstore/globals.hh (Settings) Add clientUid and clientGid.
* nix/nix-daemon/nix-daemon.cc (daemonLoop] Store UID and GID of the
  caller in settings.
* nix/libstore/build.cc (_chown): New function.
  (DerivationGoal::deleteTmpDir): Use it, change ownership of build
  directory if it is kept and the new owner is not root.
Diffstat (limited to 'nix/libstore/globals.hh')
-rw-r--r--nix/libstore/globals.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/nix/libstore/globals.hh b/nix/libstore/globals.hh
index 8c07e360f2..7beb1a55ca 100644
--- a/nix/libstore/globals.hh
+++ b/nix/libstore/globals.hh
@@ -70,6 +70,12 @@ struct Settings {
        subgoal of the same goal) fails. */
     bool keepGoing;
 
+    /* User and groud id of the client issuing the build request.  Used to set
+       the owner and group of the kept temporary directories of failed
+       builds. */
+    uid_t clientUid;
+    gid_t clientGid;
+
     /* Whether, if we cannot realise the known closure corresponding
        to a derivation, we should try to normalise the derivation
        instead. */