1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-03 18:38:27 +01:00

Handle Subversion SSH on nonstandard ports

Summary:
Fixes T11203. Subversion handling of `SVN_SSH` commands requires some additional finesse for nonstandard remote SSH ports.

We get `domain.com:port` in the command, so parse it out if it's present.

Test Plan: @enckse confirmed this locally in T11203.

Reviewers: chad

Reviewed By: chad

Subscribers: enckse

Maniphest Tasks: T11203

Differential Revision: https://secure.phabricator.com/D16172
This commit is contained in:
epriestley 2016-06-23 06:40:03 -07:00
parent a2cb5e1347
commit 70463e8a16

View file

@ -88,7 +88,22 @@ if ($as_device) {
$arguments[] = AlmanacKeys::getKeyPath('device.key'); $arguments[] = AlmanacKeys::getKeyPath('device.key');
} }
// Subversion passes us a host in the form "domain.com:port", which is not
// valid for normal SSH but which we can parse into a valid "-p" flag.
$passthru_args = $unconsumed_argv;
$host = array_shift($passthru_args);
$parts = explode(':', $host, 2);
$host = $parts[0];
$port = $args->getArg('port'); $port = $args->getArg('port');
if (!$port) {
if (count($parts) == 2) {
$port = $parts[1];
}
}
if ($port) { if ($port) {
$pattern[] = '-p %d'; $pattern[] = '-p %d';
$arguments[] = $port; $arguments[] = $port;
@ -96,7 +111,9 @@ if ($port) {
$pattern[] = '--'; $pattern[] = '--';
$passthru_args = $unconsumed_argv; $pattern[] = '%s';
$arguments[] = $host;
foreach ($passthru_args as $passthru_arg) { foreach ($passthru_args as $passthru_arg) {
$pattern[] = '%s'; $pattern[] = '%s';
$arguments[] = $passthru_arg; $arguments[] = $passthru_arg;