- (djm) OpenBSD CVS Sync

- djm@cvs.openbsd.org 2005/06/17 22:53:47
     [ssh.c sshconnect.c]
     Fix ControlPath's %p expanding to "0" for a default port,
     spotted dwmw2 AT infradead.org; ok markus@
This commit is contained in:
Damien Miller 2005-06-26 08:55:25 +10:00
parent 52c8afeec5
commit 9651fe690a
3 changed files with 17 additions and 12 deletions

View File

@ -1,3 +1,10 @@
20050626
- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2005/06/17 22:53:47
[ssh.c sshconnect.c]
Fix ControlPath's %p expanding to "0" for a default port,
spotted dwmw2 AT infradead.org; ok markus@
20050618 20050618
- (djm) OpenBSD CVS Sync - (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2005/05/20 12:57:01; - djm@cvs.openbsd.org 2005/05/20 12:57:01;
@ -2749,4 +2756,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.3827 2005/06/19 00:19:43 djm Exp $ $Id: ChangeLog,v 1.3828 2005/06/25 22:55:25 djm Exp $

9
ssh.c
View File

@ -40,7 +40,7 @@
*/ */
#include "includes.h" #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/evp.h>
#include <openssl/err.h> #include <openssl/err.h>
@ -185,6 +185,7 @@ main(int ac, char **av)
int dummy; int dummy;
extern int optind, optreset; extern int optind, optreset;
extern char *optarg; extern char *optarg;
struct servent *sp;
Forward fwd; Forward fwd;
__progname = ssh_get_progname(av[0]); __progname = ssh_get_progname(av[0]);
@ -623,6 +624,12 @@ again:
if (options.control_path != NULL) if (options.control_path != NULL)
control_client(options.control_path); 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. */ /* Open a connection to the remote host. */
if (ssh_connect(host, &hostaddr, options.port, if (ssh_connect(host, &hostaddr, options.port,
options.address_family, options.connection_attempts, options.address_family, options.connection_attempts,

View File

@ -13,7 +13,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: sshconnect.c,v 1.165 2005/06/17 02:44:33 djm Exp $"); RCSID("$OpenBSD: sshconnect.c,v 1.166 2005/06/17 22:53:47 djm Exp $");
#include <openssl/bn.h> #include <openssl/bn.h>
@ -289,18 +289,9 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
int sock = -1, attempt; int sock = -1, attempt;
char ntop[NI_MAXHOST], strport[NI_MAXSERV]; char ntop[NI_MAXHOST], strport[NI_MAXSERV];
struct addrinfo hints, *ai, *aitop; struct addrinfo hints, *ai, *aitop;
struct servent *sp;
debug2("ssh_connect: needpriv %d", needpriv); 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 a proxy command is given, connect using it. */
if (proxy_command != NULL) if (proxy_command != NULL)
return ssh_proxy_connect(host, port, proxy_command); return ssh_proxy_connect(host, port, proxy_command);