Changeset View
Changeset View
Standalone View
Standalone View
scripts/ssh/ssh-exec.php
Context not available. | |||||
$ssh_client = getenv('SSH_CLIENT'); | $ssh_client = getenv('SSH_CLIENT'); | ||||
if ($ssh_client) { | if ($ssh_client) { | ||||
// This has the format "<ip> <remote-port> <local-port>". Grab the IP. | // This has the format "<ip> <remote-port> <local-port>". Grab the IP. | ||||
$remote_address = head(explode(' ', $ssh_client)); | $remote_address = head(@explode(' ', $ssh_client)); | ||||
$ssh_log->setData( | $ssh_log->setData( | ||||
array( | array( | ||||
'r' => $remote_address, | 'r' => $remote_address, | ||||
Context not available. | |||||
'--phabricator-ssh-device', | '--phabricator-ssh-device', | ||||
$user_name, | $user_name, | ||||
$device_name)); | $device_name)); | ||||
} else if (strlen($user_name)) { | } else if (@strlen($user_name)) { | ||||
$user = id(new PhabricatorPeopleQuery()) | $user = id(new PhabricatorPeopleQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
->withUsernames(array($user_name)) | ->withUsernames(array($user_name)) | ||||
Context not available. | |||||
id(new PhabricatorAuthSessionEngine()) | id(new PhabricatorAuthSessionEngine()) | ||||
->willServeRequestForUser($user); | ->willServeRequestForUser($user); | ||||
} else if (strlen($device_name)) { | } else if (@strlen($device_name)) { | ||||
if (!$remote_address) { | if (!$remote_address) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
Context not available. | |||||
// If we're authenticating as a device, the first argument may be a | // If we're authenticating as a device, the first argument may be a | ||||
// "@username" argument to act as a particular user. | // "@username" argument to act as a particular user. | ||||
$first_argument = head($original_argv); | $first_argument = head($original_argv); | ||||
if (preg_match('/^@/', $first_argument)) { | if (@preg_match('/^@/', $first_argument)) { | ||||
$act_as_name = array_shift($original_argv); | $act_as_name = array_shift($original_argv); | ||||
$act_as_name = substr($act_as_name, 1); | $act_as_name = @substr($act_as_name, 1); | ||||
$user = id(new PhabricatorPeopleQuery()) | $user = id(new PhabricatorPeopleQuery()) | ||||
->setViewer(PhabricatorUser::getOmnipotentUser()) | ->setViewer(PhabricatorUser::getOmnipotentUser()) | ||||
->withUsernames(array($act_as_name)) | ->withUsernames(array($act_as_name)) | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0