diff options
Diffstat (limited to 'vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php')
-rw-r--r-- | vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php b/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php index f65b587cb..ec1d9773e 100644 --- a/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php +++ b/vendor/phpseclib/phpseclib/phpseclib/System/SSH/Agent.php @@ -133,9 +133,20 @@ class Agent } } - $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); - if (!$this->fsock) { - user_error("Unable to connect to ssh-agent (Error $errno: $errstr)"); + if (in_array('unix', stream_get_transports())) { + $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); + if (!$this->fsock) { + user_error("Unable to connect to ssh-agent (Error $errno: $errstr)"); + } + } else { + if (substr($address, 0, 9) != '\\\\.\\pipe\\' || strpos(substr($address, 9), '\\') !== false) { + user_error('Address is not formatted as a named pipe should be'); + } else { + $this->fsock = fopen($address, 'r+b'); + if (!$this->fsock) { + user_error('Unable to open address'); + } + } } } |