about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2005-02-17T13·55+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2005-02-17T13·55+0000
commit8a3a96dd5b009d337c0cd12b58a41c943d0aa516 (patch)
tree2c7ceb2d2ba188ee20a11c84344dad8f202dad4f /src
parent88273f9574fc137301b6a65669eb20f18d7a3b61 (diff)
* Switch to the calling user context for some more operations in a
  setuid installation.

Diffstat (limited to 'src')
-rw-r--r--src/libstore/gc.cc7
-rw-r--r--src/nix-store/main.cc1
2 files changed, 6 insertions, 2 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index e0de6a968131..e1075d0251fd 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -87,8 +87,11 @@ Path addPermRoot(const Path & _storePath, const Path & _gcRoot,
         string hash = printHash32(hashString(htSHA1, gcRoot));
         Path realRoot = canonPath((format("%1%/%2%/auto/%3%")
             % nixStateDir % gcRootsDir % hash).str());
-
-        createSymlink(gcRoot, storePath, true);
+        
+        {
+            SwitchToOriginalUser sw;
+            createSymlink(gcRoot, storePath, true);
+        }
         createSymlink(realRoot, gcRoot, false);
     }
 
diff --git a/src/nix-store/main.cc b/src/nix-store/main.cc
index a93956ab7a27..4227f0cca32a 100644
--- a/src/nix-store/main.cc
+++ b/src/nix-store/main.cc
@@ -25,6 +25,7 @@ static bool indirectRoot = false;
 
 static Path fixPath(Path path)
 {
+    SwitchToOriginalUser sw;
     path = absPath(path);
     while (!isInStore(path)) {
         if (!isLink(path)) break;