]> andersk Git - openssh.git/blobdiff - ssh.c
- (djm) OpenBSD CVS Sync
[openssh.git] / ssh.c
diff --git a/ssh.c b/ssh.c
index 5d53cd6804bf29077b711f6e9d1fa7b588205591..2e93b161ae1a8e2ec6ad1771145f60d0b534ec8c 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.243 2005/06/16 03:38:36 djm Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.244 2005/06/17 22:53:46 djm Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/err.h>
@@ -185,6 +185,7 @@ main(int ac, char **av)
        int dummy;
        extern int optind, optreset;
        extern char *optarg;
+       struct servent *sp;
        Forward fwd;
 
        __progname = ssh_get_progname(av[0]);
@@ -623,6 +624,12 @@ again:
        if (options.control_path != NULL)
                control_client(options.control_path);
 
+       /* Get default port if port has not been set. */
+       if (options.port == 0) {
+               sp = getservbyname(SSH_SERVICE_NAME, "tcp");
+               options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT;
+       }
+
        /* Open a connection to the remote host. */
        if (ssh_connect(host, &hostaddr, options.port,
            options.address_family, options.connection_attempts,
This page took 1.35024 seconds and 4 git commands to generate.