|
Lines 50-55
Link Here
|
| 50 |
static int show_other_keys(const char *, Key *); |
50 |
static int show_other_keys(const char *, Key *); |
| 51 |
|
51 |
|
| 52 |
/* |
52 |
/* |
|
|
53 |
* Check whether the configured proxy command is to be used |
| 54 |
*/ |
| 55 |
static int |
| 56 |
ssh_use_proxy_command(const char *proxy_command) |
| 57 |
{ |
| 58 |
/* |
| 59 |
* If proxy_command is NULL or points to " none", don't use it. |
| 60 |
* Note that we have to compare against " none" (and not "none"), |
| 61 |
* because the code that parses ProxyCommand in readconf.c always adds |
| 62 |
* a space in front of the actual command. |
| 63 |
*/ |
| 64 |
if (proxy_command == NULL || strcmp(proxy_command, " none") == 0) |
| 65 |
return 0; |
| 66 |
else |
| 67 |
return 1; |
| 68 |
} |
| 69 |
|
| 70 |
/* |
| 53 |
* Connect to the given ssh server using a proxy command. |
71 |
* Connect to the given ssh server using a proxy command. |
| 54 |
*/ |
72 |
*/ |
| 55 |
static int |
73 |
static int |
|
Lines 219-227
Link Here
|
| 219 |
* a privileged port will be allocated to make the connection. |
237 |
* a privileged port will be allocated to make the connection. |
| 220 |
* This requires super-user privileges if needpriv is true. |
238 |
* This requires super-user privileges if needpriv is true. |
| 221 |
* Connection_attempts specifies the maximum number of tries (one per |
239 |
* Connection_attempts specifies the maximum number of tries (one per |
| 222 |
* second). If proxy_command is non-NULL, it specifies the command (with %h |
240 |
* second). If proxy_command is non-NULL and not "none", it specifies |
| 223 |
* and %p substituted for host and port, respectively) to use to contact |
241 |
* the command (with %h and %p substituted for host and port, |
| 224 |
* the daemon. |
242 |
* respectively) to use to contact the daemon. |
| 225 |
* Return values: |
243 |
* Return values: |
| 226 |
* 0 for OK |
244 |
* 0 for OK |
| 227 |
* ECONNREFUSED if we got a "Connection Refused" by the peer on any address |
245 |
* ECONNREFUSED if we got a "Connection Refused" by the peer on any address |
|
Lines 258-264
Link Here
|
| 258 |
port = SSH_DEFAULT_PORT; |
276 |
port = SSH_DEFAULT_PORT; |
| 259 |
} |
277 |
} |
| 260 |
/* If a proxy command is given, connect using it. */ |
278 |
/* If a proxy command is given, connect using it. */ |
| 261 |
if (proxy_command != NULL) |
279 |
if (ssh_use_proxy_command(proxy_command) == 1) |
| 262 |
return ssh_proxy_connect(host, port, proxy_command); |
280 |
return ssh_proxy_connect(host, port, proxy_command); |
| 263 |
|
281 |
|
| 264 |
/* No proxy command. */ |
282 |
/* No proxy command. */ |
|
Lines 535-541
Link Here
|
| 535 |
* We don't have the remote ip-address for connections |
553 |
* We don't have the remote ip-address for connections |
| 536 |
* using a proxy command |
554 |
* using a proxy command |
| 537 |
*/ |
555 |
*/ |
| 538 |
if (options.proxy_command == NULL) { |
556 |
if (ssh_use_proxy_command(options.proxy_command) == 0) { |
| 539 |
if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), |
557 |
if (getnameinfo(hostaddr, salen, ntop, sizeof(ntop), |
| 540 |
NULL, 0, NI_NUMERICHOST) != 0) |
558 |
NULL, 0, NI_NUMERICHOST) != 0) |
| 541 |
fatal("check_host_key: getnameinfo failed"); |
559 |
fatal("check_host_key: getnameinfo failed"); |
|
Lines 548-554
Link Here
|
| 548 |
* command or if we don't have a hostname to compare with |
566 |
* command or if we don't have a hostname to compare with |
| 549 |
*/ |
567 |
*/ |
| 550 |
if (options.check_host_ip && |
568 |
if (options.check_host_ip && |
| 551 |
(local || strcmp(host, ip) == 0 || options.proxy_command != NULL)) |
569 |
(local || strcmp(host, ip) == 0 || |
|
|
570 |
ssh_use_proxy_command(options.proxy_command) == 1)) |
| 552 |
options.check_host_ip = 0; |
571 |
options.check_host_ip = 0; |
| 553 |
|
572 |
|
| 554 |
/* |
573 |
/* |