System/SSH/Agent: add parameter to constructor

This commit is contained in:
terrafrost 2018-12-01 22:41:45 -06:00
parent 8f2a0e6f0d
commit fbef6f009f

View File

@ -352,8 +352,9 @@ class System_SSH_Agent
* @return System_SSH_Agent * @return System_SSH_Agent
* @access public * @access public
*/ */
function __construct() function __construct($address = null)
{ {
if (!$address) {
switch (true) { switch (true) {
case isset($_SERVER['SSH_AUTH_SOCK']): case isset($_SERVER['SSH_AUTH_SOCK']):
$address = $_SERVER['SSH_AUTH_SOCK']; $address = $_SERVER['SSH_AUTH_SOCK'];
@ -365,6 +366,7 @@ class System_SSH_Agent
user_error('SSH_AUTH_SOCK not found'); user_error('SSH_AUTH_SOCK not found');
return false; return false;
} }
}
$this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr); $this->fsock = fsockopen('unix://' . $address, 0, $errno, $errstr);
if (!$this->fsock) { if (!$this->fsock) {
@ -378,9 +380,9 @@ class System_SSH_Agent
* @see self::__construct() * @see self::__construct()
* @access public * @access public
*/ */
function System_SSH_Agent() function System_SSH_Agent($address = null)
{ {
$this->__construct(); $this->__construct($address);
} }
/** /**