From d8ddf994e70f97994e0f1fbd382df93cd071b90f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 2 Jun 2015 02:21:54 +0200 Subject: Don't let unprivileged users repair paths --- src/nix-daemon/nix-daemon.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/nix-daemon/nix-daemon.cc') diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc index b3552a972..ad8b0d133 100644 --- a/src/nix-daemon/nix-daemon.cc +++ b/src/nix-daemon/nix-daemon.cc @@ -520,13 +520,15 @@ static void performOp(bool trusted, unsigned int clientVersion, break; case wopVerifyStore: { - bool checkContents = readInt(from) != 0; - bool repair = readInt(from) != 0; - startWork(); - bool errors = store->verifyStore(checkContents, repair); - stopWork(); - writeInt(errors, to); - break; + bool checkContents = readInt(from) != 0; + bool repair = readInt(from) != 0; + startWork(); + if (repair && !trusted) + throw Error("you are not privileged to repair paths"); + bool errors = store->verifyStore(checkContents, repair); + stopWork(); + writeInt(errors, to); + break; } default: -- cgit v1.2.3