From 7c71cc738c87905561d64eeb95ea7327917089f2 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 26 Jun 2005 08:56:31 +1000 Subject: - djm@cvs.openbsd.org 2005/06/25 22:47:49 [ssh.c] do the default port filling code a few lines earlier, so it really does fix %p --- ChangeLog | 5 ++++- ssh.c | 14 +++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 519168aa3..cdeb942f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ - djm@cvs.openbsd.org 2005/06/18 04:30:36 [ssh.c ssh_config.5] allow ControlPath=none, patch from dwmw2 AT infradead.org; ok dtucker@ + - djm@cvs.openbsd.org 2005/06/25 22:47:49 + [ssh.c] + do the default port filling code a few lines earlier, so it really does fix %p 20050618 - (djm) OpenBSD CVS Sync @@ -2759,4 +2762,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3829 2005/06/25 22:56:03 djm Exp $ +$Id: ChangeLog,v 1.3830 2005/06/25 22:56:31 djm Exp $ diff --git a/ssh.c b/ssh.c index 91f8559de..67af53e69 100644 --- a/ssh.c +++ b/ssh.c @@ -40,7 +40,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: ssh.c,v 1.245 2005/06/18 04:30:36 djm Exp $"); +RCSID("$OpenBSD: ssh.c,v 1.246 2005/06/25 22:47:49 djm Exp $"); #include #include @@ -607,6 +607,12 @@ again: *p = tolower(*p); } + /* 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; + } + if (options.proxy_command != NULL && strcmp(options.proxy_command, "none") == 0) options.proxy_command = NULL; @@ -627,12 +633,6 @@ 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, -- cgit v1.2.3