mirror of
https://github.com/NixOS/nix.git
synced 2025-11-13 22:12:43 +01:00
Implement shellSplitString for proper handling of NIX_SSHOPTS with spaces and quotes
This commit is contained in:
parent
44bc4c6365
commit
366611391e
5 changed files with 248 additions and 4 deletions
|
|
@ -41,8 +41,17 @@ void SSHMaster::addCommonSSHOpts(Strings & args)
|
|||
{
|
||||
auto state(state_.lock());
|
||||
|
||||
for (auto & i : tokenizeString<Strings>(getEnv("NIX_SSHOPTS").value_or("")))
|
||||
args.push_back(i);
|
||||
std::string sshOpts = getEnv("NIX_SSHOPTS").value_or("");
|
||||
|
||||
try {
|
||||
std::list<std::string> opts = shellSplitString(sshOpts);
|
||||
for (auto & i : opts)
|
||||
args.push_back(i);
|
||||
} catch (Error & e) {
|
||||
e.addTrace({}, "while splitting NIX_SSHOPTS '%s'", sshOpts);
|
||||
throw;
|
||||
}
|
||||
|
||||
if (!keyFile.empty())
|
||||
args.insert(args.end(), {"-i", keyFile});
|
||||
if (!sshPublicHostKey.empty()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue