Skip to content

Commit 70463e8

Browse files
author
epriestley
committed
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
1 parent a2cb5e1 commit 70463e8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

scripts/ssh/ssh-connect.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,32 @@ function ssh_connect_signal($signo) {
8888
$arguments[] = AlmanacKeys::getKeyPath('device.key');
8989
}
9090

91+
// Subversion passes us a host in the form "domain.com:port", which is not
92+
// valid for normal SSH but which we can parse into a valid "-p" flag.
93+
94+
$passthru_args = $unconsumed_argv;
95+
$host = array_shift($passthru_args);
96+
$parts = explode(':', $host, 2);
97+
$host = $parts[0];
98+
9199
$port = $args->getArg('port');
100+
101+
if (!$port) {
102+
if (count($parts) == 2) {
103+
$port = $parts[1];
104+
}
105+
}
106+
92107
if ($port) {
93108
$pattern[] = '-p %d';
94109
$arguments[] = $port;
95110
}
96111

97112
$pattern[] = '--';
98113

99-
$passthru_args = $unconsumed_argv;
114+
$pattern[] = '%s';
115+
$arguments[] = $host;
116+
100117
foreach ($passthru_args as $passthru_arg) {
101118
$pattern[] = '%s';
102119
$arguments[] = $passthru_arg;

0 commit comments

Comments
 (0)