%h,%p,%u expansion for ControlPath
David Woodhouse
dwmw2 at infradead.org
Thu Jun 23 22:17:24 EST 2005
On Thu, 2005-06-16 at 13:29 +1000, Damien Miller wrote:
> > OK, I've checked out the OpenBSD version and I see it now. In that
> > version it looks like '%p' is going to expand to '0' when the default
> > port is used, instead of to '22' as it should.
>
> Yes, I noticed that too - i'll fix it shortly.
Still looks unfixed to me -- or has that just not propagated to the
portable tree yet?
--- openssh/readconf.c~ 2005-06-23 12:20:15.000000000 +0100
+++ openssh/readconf.c 2005-06-23 13:06:59.000000000 +0100
@@ -1025,8 +1025,13 @@ fill_default_options(Options * options)
options->tcp_keep_alive = 1;
if (options->compression_level == -1)
options->compression_level = 6;
- if (options->port == -1)
- options->port = 0; /* Filled in ssh_connect. */
+ if (options->port == -1) {
+ struct servent *sp = getservbyname(SSH_SERVICE_NAME, "tcp");
+ if (sp)
+ options->port = ntohs(sp->s_port);
+ else
+ options->port = SSH_DEFAULT_PORT;
+ }
if (options->address_family == -1)
options->address_family = AF_UNSPEC;
if (options->connection_attempts == -1)
--- openssh/sshconnect.c~ 2005-06-17 03:59:35.000000000 +0100
+++ openssh/sshconnect.c 2005-06-23 13:06:59.000000000 +0100
@@ -289,18 +289,9 @@ ssh_connect(const char *host, struct soc
int sock = -1, attempt;
char ntop[NI_MAXHOST], strport[NI_MAXSERV];
struct addrinfo hints, *ai, *aitop;
- struct servent *sp;
debug2("ssh_connect: needpriv %d", needpriv);
- /* Get default port if port has not been set. */
- if (port == 0) {
- sp = getservbyname(SSH_SERVICE_NAME, "tcp");
- if (sp)
- port = ntohs(sp->s_port);
- else
- port = SSH_DEFAULT_PORT;
- }
/* If a proxy command is given, connect using it. */
if (proxy_command != NULL)
return ssh_proxy_connect(host, port, proxy_command);
--
dwmw2
More information about the openssh-unix-dev
mailing list