From 120ca30816f19d3558a626a08bf29c9d5a374a8d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Sep 2024 17:46:20 +0200 Subject: [PATCH] Filter out client-only-settings on the daemon --- src/libstore/daemon.cc | 4 ++++ tests/functional/remote-store.sh | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc index 6079eae7b..7b4e306d4 100644 --- a/src/libstore/daemon.cc +++ b/src/libstore/daemon.cc @@ -238,9 +238,13 @@ struct ClientSettings return true; }; + auto clientOnlySettings = settings.clientOnlySettings.get(); + try { if (name == "ssh-auth-sock") // obsolete ; + else if (clientOnlySettings.contains(name)) + ; else if (name == experimentalFeatureSettings.experimentalFeatures.name) { // We don’t want to forward the experimental features to // the daemon, as that could cause some pretty weird stuff diff --git a/tests/functional/remote-store.sh b/tests/functional/remote-store.sh index 6e7326746..8237c7153 100755 --- a/tests/functional/remote-store.sh +++ b/tests/functional/remote-store.sh @@ -37,7 +37,7 @@ cmp $TEST_ROOT/d1 $TEST_ROOT/d2 killDaemon -# Test 'client-only-settings'. +# Test 'client-only-settings' on the client. extraDaemonFlags=("--trusted-users" "") startDaemon nix store info --netrc-file /foo 2>&1 | grepQuiet "ignoring the client-specified setting 'netrc-file'" @@ -45,3 +45,11 @@ if nix store info --netrc-file /foo --client-only-settings netrc-file 2>&1 | gre exit 1 fi killDaemon + +# Test 'client-only-settings' on the daemon. +extraDaemonFlags=("--trusted-users" "" "--option" "client-only-settings" "netrc-file") +startDaemon +if nix store info --netrc-file /foo 2>&1 | grep "ignoring the client-specified setting 'netrc-file'"; then + exit 1 +fi +killDaemon