Disallow SSH host names starting with a dash
This commit is contained in:
parent
82c4b37c6f
commit
e4bd42f98f
2 changed files with 12 additions and 8 deletions
|
@ -2,6 +2,17 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
SSHMaster::SSHMaster(const std::string & host, const std::string & keyFile, bool useMaster, bool compress, int logFD)
|
||||
: host(host)
|
||||
, keyFile(keyFile)
|
||||
, useMaster(useMaster)
|
||||
, compress(compress)
|
||||
, logFD(logFD)
|
||||
{
|
||||
if (host == "" || hasPrefix(host, "-"))
|
||||
throw Error("invalid SSH host name '%s'", host);
|
||||
}
|
||||
|
||||
void SSHMaster::addCommonSSHOpts(Strings & args)
|
||||
{
|
||||
for (auto & i : tokenizeString<Strings>(getEnv("NIX_SSHOPTS")))
|
||||
|
|
|
@ -28,14 +28,7 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
SSHMaster(const std::string & host, const std::string & keyFile, bool useMaster, bool compress, int logFD = -1)
|
||||
: host(host)
|
||||
, keyFile(keyFile)
|
||||
, useMaster(useMaster)
|
||||
, compress(compress)
|
||||
, logFD(logFD)
|
||||
{
|
||||
}
|
||||
SSHMaster(const std::string & host, const std::string & keyFile, bool useMaster, bool compress, int logFD = -1);
|
||||
|
||||
struct Connection
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue