diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: ssh.c,v 1.243 2005/06/16 03:38:36 djm Exp $"); | 43 | RCSID("$OpenBSD: ssh.c,v 1.244 2005/06/17 22:53:46 djm Exp $"); |
44 | 44 | ||
45 | #include <openssl/evp.h> | 45 | #include <openssl/evp.h> |
46 | #include <openssl/err.h> | 46 | #include <openssl/err.h> |
@@ -185,6 +185,7 @@ main(int ac, char **av) | |||
185 | int dummy; | 185 | int dummy; |
186 | extern int optind, optreset; | 186 | extern int optind, optreset; |
187 | extern char *optarg; | 187 | extern char *optarg; |
188 | struct servent *sp; | ||
188 | Forward fwd; | 189 | Forward fwd; |
189 | 190 | ||
190 | __progname = ssh_get_progname(av[0]); | 191 | __progname = ssh_get_progname(av[0]); |
@@ -623,6 +624,12 @@ again: | |||
623 | if (options.control_path != NULL) | 624 | if (options.control_path != NULL) |
624 | control_client(options.control_path); | 625 | control_client(options.control_path); |
625 | 626 | ||
627 | /* Get default port if port has not been set. */ | ||
628 | if (options.port == 0) { | ||
629 | sp = getservbyname(SSH_SERVICE_NAME, "tcp"); | ||
630 | options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT; | ||
631 | } | ||
632 | |||
626 | /* Open a connection to the remote host. */ | 633 | /* Open a connection to the remote host. */ |
627 | if (ssh_connect(host, &hostaddr, options.port, | 634 | if (ssh_connect(host, &hostaddr, options.port, |
628 | options.address_family, options.connection_attempts, | 635 | options.address_family, options.connection_attempts, |