Changeset View
Changeset View
Standalone View
Standalone View
scripts/ssh/ssh-connect.php
| Show All 21 Lines | |||||
| $args->parsePartial( | $args->parsePartial( | ||||
| array( | array( | ||||
| array( | array( | ||||
| 'name' => 'port', | 'name' => 'port', | ||||
| 'short' => 'p', | 'short' => 'p', | ||||
| 'param' => pht('port'), | 'param' => pht('port'), | ||||
| 'help' => pht('Port number to connect to.'), | 'help' => pht('Port number to connect to.'), | ||||
| ), | ), | ||||
| array( | |||||
| 'name' => 'options', | |||||
| 'short' => 'o', | |||||
| 'param' => pht('options'), | |||||
| 'repeat' => true, | |||||
| 'help' => pht('SSH options.'), | |||||
| ), | |||||
| )); | )); | ||||
| $unconsumed_argv = $args->getUnconsumedArgumentVector(); | $unconsumed_argv = $args->getUnconsumedArgumentVector(); | ||||
| if (function_exists('pcntl_signal')) { | if (function_exists('pcntl_signal')) { | ||||
| pcntl_signal(SIGTERM, 'ssh_connect_signal'); | pcntl_signal(SIGTERM, 'ssh_connect_signal'); | ||||
| } | } | ||||
| function ssh_connect_signal($signo) { | function ssh_connect_signal($signo) { | ||||
| // This is just letting destructors fire. In particular, we want to clean | // This is just letting destructors fire. In particular, we want to clean | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | if (!$port) { | ||||
| } | } | ||||
| } | } | ||||
| if ($port) { | if ($port) { | ||||
| $pattern[] = '-p %d'; | $pattern[] = '-p %d'; | ||||
| $arguments[] = $port; | $arguments[] = $port; | ||||
| } | } | ||||
| $options = $args->getArg('options'); | |||||
| $allowed_ssh_options = array('SendEnv=GIT_PROTOCOL'); | |||||
| if (!empty($options)) { | |||||
| foreach ($options as $option) { | |||||
| if (array_search($option, $allowed_ssh_options) !== false) { | |||||
artms: This will essentially dump "unrecognized" options, please advise if such behavior is acceptable? | |||||
| $pattern[] = '-o %s'; | |||||
| $arguments[] = $option; | |||||
| } | |||||
| } | |||||
| } | |||||
| $pattern[] = '--'; | $pattern[] = '--'; | ||||
| $pattern[] = '%s'; | $pattern[] = '%s'; | ||||
| $arguments[] = $host; | $arguments[] = $host; | ||||
| foreach ($passthru_args as $passthru_arg) { | foreach ($passthru_args as $passthru_arg) { | ||||
| $pattern[] = '%s'; | $pattern[] = '%s'; | ||||
| $arguments[] = $passthru_arg; | $arguments[] = $passthru_arg; | ||||
| Show All 9 Lines | |||||
This will essentially dump "unrecognized" options, please advise if such behavior is acceptable? We can also "crash" if unrecognized options is passed to have less surprises in future when some unrecognized option is passed to ssh command