[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
115/376: Move some options out of globals
From: |
Ludovic Courtès |
Subject: |
115/376: Move some options out of globals |
Date: |
Wed, 28 Jan 2015 22:04:25 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 988bf594215007c96903b4a646b0cf024fb8f596
Author: Eelco Dolstra <address@hidden>
Date: Mon Aug 4 18:13:14 2014 +0200
Move some options out of globals
---
src/download-via-ssh/download-via-ssh.cc | 2 +-
src/libstore/globals.cc | 12 ++++++++----
src/libstore/globals.hh | 4 +++-
src/nix-daemon/nix-daemon.cc | 3 +++
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/download-via-ssh/download-via-ssh.cc
b/src/download-via-ssh/download-via-ssh.cc
index 466233c..688fb52 100644
--- a/src/download-via-ssh/download-via-ssh.cc
+++ b/src/download-via-ssh/download-via-ssh.cc
@@ -103,7 +103,7 @@ void run(Strings args)
/* Pass on the location of the daemon client's SSH authentication
socket. */
- string sshAuthSock = settings.get("ssh-auth-sock");
+ string sshAuthSock = settings.get("ssh-auth-sock", "");
if (sshAuthSock != "") setenv("SSH_AUTH_SOCK", sshAuthSock.c_str(), 1);
string host = settings.sshSubstituterHosts.front();
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 8fad6e5..23ece4a 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -63,8 +63,6 @@ Settings::Settings()
lockCPU = getEnv("NIX_AFFINITY_HACK", "1") == "1";
showTrace = false;
enableImportNative = false;
- trustedUsers = Strings({"root"});
- allowedUsers = Strings({"*"});
}
@@ -130,6 +128,14 @@ string Settings::get(const string & name, const string &
def)
}
+Strings Settings::get(const string & name, const Strings & def)
+{
+ auto i = settings.find(name);
+ if (i == settings.end()) return def;
+ return tokenizeString<Strings>(i->second);
+}
+
+
void Settings::update()
{
_get(tryFallback, "build-fallback");
@@ -161,8 +167,6 @@ void Settings::update()
_get(logServers, "log-servers");
_get(enableImportNative, "allow-unsafe-native-code-during-evaluation");
_get(useCaseHack, "use-case-hack");
- _get(trustedUsers, "trusted-users");
- _get(allowedUsers, "allowed-users");
string subs = getEnv("NIX_SUBSTITUTERS", "default");
if (subs == "default") {
diff --git a/src/libstore/globals.hh b/src/libstore/globals.hh
index 1202f5d..743d206 100644
--- a/src/libstore/globals.hh
+++ b/src/libstore/globals.hh
@@ -21,7 +21,9 @@ struct Settings {
void set(const string & name, const string & value);
- string get(const string & name, const string & def = "");
+ string get(const string & name, const string & def);
+
+ Strings get(const string & name, const Strings & def);
void update();
diff --git a/src/nix-daemon/nix-daemon.cc b/src/nix-daemon/nix-daemon.cc
index 2d6a3c4..77c63f1 100644
--- a/src/nix-daemon/nix-daemon.cc
+++ b/src/nix-daemon/nix-daemon.cc
@@ -743,6 +743,9 @@ static void daemonLoop()
struct group * gr = getgrgid(cred.gid);
string group = gr ? gr->gr_name : int2String(cred.gid);
+ Strings trustedUsers = settings.get("trusted-users",
Strings({"root"}));
+ Strings allowedUsers = settings.get("allowed-users",
Strings({"*"}));
+
if (matchUser(user, group, settings.trustedUsers))
trusted = true;
- 107/376: Call commonChildInit() before doing chroot init, (continued)
- 107/376: Call commonChildInit() before doing chroot init, Ludovic Courtès, 2015/01/28
- 104/376: Make readDirectory() return inode / file type, Ludovic Courtès, 2015/01/28
- 106/376: Eliminate redundant copy, Ludovic Courtès, 2015/01/28
- 110/376: Make chroot builds easier to set up, Ludovic Courtès, 2015/01/28
- 109/376: Speed up nix-shell, Ludovic Courtès, 2015/01/28
- 121/376: nix-install-package: Use extra-binary-caches, Ludovic Courtès, 2015/01/28
- 119/376: Add support for order-only dependencies, Ludovic Courtès, 2015/01/28
- 118/376: install-nix-from-closure.sh: Use https channel if possible, Ludovic Courtès, 2015/01/28
- 114/376: Refactor, Ludovic Courtès, 2015/01/28
- 117/376: Remove unnecessary call to addTempRoot(), Ludovic Courtès, 2015/01/28
- 115/376: Move some options out of globals,
Ludovic Courtès <=
- 116/376: Doh, Ludovic Courtès, 2015/01/28
- 112/376: Add option ‘build-extra-chroot-dirs’, Ludovic Courtès, 2015/01/28
- 111/376: Get rid of "killing <pid>" message for unused build hooks, Ludovic Courtès, 2015/01/28
- 129/376: Remove log2html.xsl and friends, Ludovic Courtès, 2015/01/28
- 122/376: Warn about untrusted binary caches in extra-binary-caches, Ludovic Courtès, 2015/01/28
- 113/376: Update manual, Ludovic Courtès, 2015/01/28
- 126/376: Handle compound single dash options properly, Ludovic Courtès, 2015/01/28
- 124/376: Fix warning about non-existant -I directories, Ludovic Courtès, 2015/01/28
- 127/376: Use regular file GC roots if possible, Ludovic Courtès, 2015/01/28
- 128/376: nix-log2xml: Handle UTF-8 characters, Ludovic Courtès, 2015/01/28