diff options
author | Marius Bakke <mbakke@fastmail.com> | 2018-04-25 15:53:41 +0200 |
---|---|---|
committer | Marius Bakke <mbakke@fastmail.com> | 2018-04-25 15:53:41 +0200 |
commit | a9fe3882b9400d6a49ca95e136e78477b3e81a07 (patch) | |
tree | b724ec1ed54d4a2c1b617a63eb05b98721f5d48a /nix | |
parent | 68c4759baa4c1bb87e1c7c5568d5cdf4e1434fb1 (diff) | |
parent | 0afeda65218ed0c82ab18762111c52a9fedd2582 (diff) | |
download | patches-a9fe3882b9400d6a49ca95e136e78477b3e81a07.tar patches-a9fe3882b9400d6a49ca95e136e78477b3e81a07.tar.gz |
Merge branch 'master' into staging
Diffstat (limited to 'nix')
-rw-r--r-- | nix/nix-daemon/nix-daemon.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/nix/nix-daemon/nix-daemon.cc b/nix/nix-daemon/nix-daemon.cc index deb7003d7e..782e4acfc5 100644 --- a/nix/nix-daemon/nix-daemon.cc +++ b/nix/nix-daemon/nix-daemon.cc @@ -54,7 +54,9 @@ static FdSink to(STDOUT_FILENO); bool canSendStderr; - +/* This variable is used to keep track of whether a connection + comes from a host other than the host running guix-daemon. */ +static bool isRemoteConnection; /* This function is called anytime we want to write something to stderr. If we're in a state where the protocol allows it (i.e., @@ -529,6 +531,11 @@ static void performOp(bool trusted, unsigned int clientVersion, } case wopCollectGarbage: { + if (isRemoteConnection) { + throw Error("Garbage collection is disabled for remote hosts."); + break; + } + GCOptions options; options.action = (GCOptions::GCAction) readInt(from); options.pathsToDelete = readStorePaths<PathSet>(from); @@ -934,6 +941,7 @@ static void acceptConnection(int fdSocket) connection. Setting these to -1 means: do not change. */ settings.clientUid = clientUid; settings.clientGid = clientGid; + isRemoteConnection = (remoteAddr.ss_family != AF_UNIX); /* Handle the connection. */ from.fd = remote; |