diff options
author | 2005-06-17 22:53:46 +0000 | |
---|---|---|
committer | 2005-06-17 22:53:46 +0000 | |
commit | 560586df4ccd002f83e6e6af6d9ba21fd3198fff (patch) | |
tree | 0a48a5f9073cfde482b2ddfc5bd4f63ef74ad8f9 /usr.bin/ssh/ssh.c | |
parent | A second approach at fixing the telnet localhost & problem (diff) | |
download | wireguard-openbsd-560586df4ccd002f83e6e6af6d9ba21fd3198fff.tar.xz wireguard-openbsd-560586df4ccd002f83e6e6af6d9ba21fd3198fff.zip |
Fix ControlPath's %p expanding to "0" for a default port,
spotted dwmw2 AT infradead.org; ok markus@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c index 4c34123f2de..813406f8e71 100644 --- a/usr.bin/ssh/ssh.c +++ b/usr.bin/ssh/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; /* @@ -616,6 +617,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, |