forked from lix-project/lix
nix-daemon: Pass on the user's $SSH_AUTH_SOCK to the SSH substituter
This commit is contained in:
parent
71a20d4d95
commit
67937907ca
|
@ -101,6 +101,11 @@ void run(Strings args)
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
|
/* Pass on the location of the daemon client's SSH authentication
|
||||||
|
socket. */
|
||||||
|
string sshAuthSock = settings.get("ssh-auth-sock");
|
||||||
|
if (sshAuthSock != "") setenv("SSH_AUTH_SOCK", sshAuthSock.c_str(), 1);
|
||||||
|
|
||||||
string host = settings.sshSubstituterHosts.front();
|
string host = settings.sshSubstituterHosts.front();
|
||||||
std::pair<FdSink, FdSource> pipes = connect(host);
|
std::pair<FdSink, FdSource> pipes = connect(host);
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,14 @@ void Settings::set(const string & name, const string & value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string Settings::get(const string & name, const string & def)
|
||||||
|
{
|
||||||
|
auto i = settings.find(name);
|
||||||
|
if (i == settings.end()) return def;
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Settings::update()
|
void Settings::update()
|
||||||
{
|
{
|
||||||
get(tryFallback, "build-fallback");
|
get(tryFallback, "build-fallback");
|
||||||
|
|
|
@ -21,6 +21,8 @@ struct Settings {
|
||||||
|
|
||||||
void set(const string & name, const string & value);
|
void set(const string & name, const string & value);
|
||||||
|
|
||||||
|
string get(const string & name, const string & def = "");
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
string pack();
|
string pack();
|
||||||
|
|
|
@ -163,6 +163,8 @@ void RemoteStore::setOptions()
|
||||||
|
|
||||||
if (GET_PROTOCOL_MINOR(daemonVersion) >= 12) {
|
if (GET_PROTOCOL_MINOR(daemonVersion) >= 12) {
|
||||||
Settings::SettingsMap overrides = settings.getOverrides();
|
Settings::SettingsMap overrides = settings.getOverrides();
|
||||||
|
if (overrides["ssh-auth-sock"] == "")
|
||||||
|
overrides["ssh-auth-sock"] = getEnv("SSH_AUTH_SOCK");
|
||||||
writeInt(overrides.size(), to);
|
writeInt(overrides.size(), to);
|
||||||
foreach (Settings::SettingsMap::iterator, i, overrides) {
|
foreach (Settings::SettingsMap::iterator, i, overrides) {
|
||||||
writeString(i->first, to);
|
writeString(i->first, to);
|
||||||
|
|
Loading…
Reference in a new issue