aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-02 12:02:03 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-02 12:02:03 -0500
commit479c0117840a5dc710019db006c5940b29d98dcc (patch)
tree7d46143502b471efbf7d39eddbe2f940383c251e /src
parentb574c70ccbc0c22fa3c5df12c6246a10eff1a5bf (diff)
Get rid of the `authHook` parameter on `processConnection`
This is (morally) dead code. As @edolstra pointed out in https://github.com/NixOS/nix/pull/5226#discussion_r1073470813, this is no longer needed. I created this in 8d4162ff9e940ea9e2f97b07f3030a722695901a, so it is fitting that I now destroy it :).
Diffstat (limited to 'src')
-rw-r--r--src/libstore/build/local-derivation-goal.cc3
-rw-r--r--src/libstore/daemon.cc7
-rw-r--r--src/libstore/daemon.hh7
-rw-r--r--src/nix/daemon.cc11
4 files changed, 5 insertions, 23 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 572f71045..8ff83f748 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -1516,8 +1516,7 @@ void LocalDerivationGoal::startDaemon()
FdSink to(remote.get());
try {
daemon::processConnection(store, from, to,
- daemon::NotTrusted, daemon::Recursive,
- [&](Store & store) {});
+ daemon::NotTrusted, daemon::Recursive);
debug("terminated daemon connection");
} catch (SysError &) {
ignoreException();
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index d6621ec0b..d1f69fe2d 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -985,8 +985,7 @@ void processConnection(
FdSource & from,
FdSink & to,
TrustedFlag trusted,
- RecursiveFlag recursive,
- std::function<void(Store &)> authHook)
+ RecursiveFlag recursive)
{
auto monitor = !recursive ? std::make_unique<MonitorFdHup>(from.fd) : nullptr;
@@ -1029,10 +1028,6 @@ void processConnection(
try {
- /* If we can't accept clientVersion, then throw an error
- *here* (not above). */
- authHook(*store);
-
tunnelLogger->stopWork();
to.flush();
diff --git a/src/libstore/daemon.hh b/src/libstore/daemon.hh
index 67755d54e..8c765615c 100644
--- a/src/libstore/daemon.hh
+++ b/src/libstore/daemon.hh
@@ -13,11 +13,6 @@ void processConnection(
FdSource & from,
FdSink & to,
TrustedFlag trusted,
- RecursiveFlag recursive,
- /* Arbitrary hook to check authorization / initialize user data / whatever
- after the protocol has been negotiated. The idea is that this function
- and everything it calls doesn't know about this stuff, and the
- `nix-daemon` handles that instead. */
- std::function<void(Store &)> authHook);
+ RecursiveFlag recursive);
}
diff --git a/src/nix/daemon.cc b/src/nix/daemon.cc
index 19fbbf155..96568fb8f 100644
--- a/src/nix/daemon.cc
+++ b/src/nix/daemon.cc
@@ -241,14 +241,7 @@ static void daemonLoop()
// Handle the connection.
FdSource from(remote.get());
FdSink to(remote.get());
- processConnection(openUncachedStore(), from, to, trusted, NotRecursive, [&](Store & store) {
-#if 0
- /* Prevent users from doing something very dangerous. */
- if (geteuid() == 0 &&
- querySetting("build-users-group", "") == "")
- throw Error("if you run 'nix-daemon' as root, then you MUST set 'build-users-group'!");
-#endif
- });
+ processConnection(openUncachedStore(), from, to, trusted, NotRecursive);
exit(0);
}, options);
@@ -301,7 +294,7 @@ static void runDaemon(bool stdio)
/* Auth hook is empty because in this mode we blindly trust the
standard streams. Limiting access to those is explicitly
not `nix-daemon`'s responsibility. */
- processConnection(openUncachedStore(), from, to, Trusted, NotRecursive, [&](Store & _){});
+ processConnection(openUncachedStore(), from, to, Trusted, NotRecursive);
}
} else
daemonLoop();