summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-06-26 08:55:25 +1000
committerDamien Miller <djm@mindrot.org>2005-06-26 08:55:25 +1000
commit9651fe690a95378cdb9b2a1cf3e8c5cb625052c7 (patch)
treeb3d356f58d5288ddf4c990f855db4c0420f7a753
parent52c8afeec57cd8f04e08816e1f4563e689f70f83 (diff)
- (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@
-rw-r--r--ChangeLog9
-rw-r--r--ssh.c9
-rw-r--r--sshconnect.c11
3 files changed, 17 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 04dce8489..c60eacc11 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
120050626
2 - (djm) OpenBSD CVS Sync
3 - djm@cvs.openbsd.org 2005/06/17 22:53:47
4 [ssh.c sshconnect.c]
5 Fix ControlPath's %p expanding to "0" for a default port,
6 spotted dwmw2 AT infradead.org; ok markus@
7
120050618 820050618
2 - (djm) OpenBSD CVS Sync 9 - (djm) OpenBSD CVS Sync
3 - djm@cvs.openbsd.org 2005/05/20 12:57:01; 10 - djm@cvs.openbsd.org 2005/05/20 12:57:01;
@@ -2749,4 +2756,4 @@
2749 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 2756 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
2750 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 2757 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
2751 2758
2752$Id: ChangeLog,v 1.3827 2005/06/19 00:19:43 djm Exp $ 2759$Id: ChangeLog,v 1.3828 2005/06/25 22:55:25 djm Exp $
diff --git a/ssh.c b/ssh.c
index 5d53cd680..2e93b161a 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
40 */ 40 */
41 41
42#include "includes.h" 42#include "includes.h"
43RCSID("$OpenBSD: ssh.c,v 1.243 2005/06/16 03:38:36 djm Exp $"); 43RCSID("$OpenBSD: ssh.c,v 1.244 2005/06/17 22:53:46 djm Exp $");
44 44
45#include <openssl/evp.h> 45#include <openssl/evp.h>
46#include <openssl/err.h> 46#include <openssl/err.h>
@@ -185,6 +185,7 @@ main(int ac, char **av)
185 int dummy; 185 int dummy;
186 extern int optind, optreset; 186 extern int optind, optreset;
187 extern char *optarg; 187 extern char *optarg;
188 struct servent *sp;
188 Forward fwd; 189 Forward fwd;
189 190
190 __progname = ssh_get_progname(av[0]); 191 __progname = ssh_get_progname(av[0]);
@@ -623,6 +624,12 @@ again:
623 if (options.control_path != NULL) 624 if (options.control_path != NULL)
624 control_client(options.control_path); 625 control_client(options.control_path);
625 626
627 /* Get default port if port has not been set. */
628 if (options.port == 0) {
629 sp = getservbyname(SSH_SERVICE_NAME, "tcp");
630 options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT;
631 }
632
626 /* Open a connection to the remote host. */ 633 /* Open a connection to the remote host. */
627 if (ssh_connect(host, &hostaddr, options.port, 634 if (ssh_connect(host, &hostaddr, options.port,
628 options.address_family, options.connection_attempts, 635 options.address_family, options.connection_attempts,
diff --git a/sshconnect.c b/sshconnect.c
index cbbe54821..92f0f3800 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -13,7 +13,7 @@
13 */ 13 */
14 14
15#include "includes.h" 15#include "includes.h"
16RCSID("$OpenBSD: sshconnect.c,v 1.165 2005/06/17 02:44:33 djm Exp $"); 16RCSID("$OpenBSD: sshconnect.c,v 1.166 2005/06/17 22:53:47 djm Exp $");
17 17
18#include <openssl/bn.h> 18#include <openssl/bn.h>
19 19
@@ -289,18 +289,9 @@ ssh_connect(const char *host, struct sockaddr_storage * hostaddr,
289 int sock = -1, attempt; 289 int sock = -1, attempt;
290 char ntop[NI_MAXHOST], strport[NI_MAXSERV]; 290 char ntop[NI_MAXHOST], strport[NI_MAXSERV];
291 struct addrinfo hints, *ai, *aitop; 291 struct addrinfo hints, *ai, *aitop;
292 struct servent *sp;
293 292
294 debug2("ssh_connect: needpriv %d", needpriv); 293 debug2("ssh_connect: needpriv %d", needpriv);
295 294
296 /* Get default port if port has not been set. */
297 if (port == 0) {
298 sp = getservbyname(SSH_SERVICE_NAME, "tcp");
299 if (sp)
300 port = ntohs(sp->s_port);
301 else
302 port = SSH_DEFAULT_PORT;
303 }
304 /* If a proxy command is given, connect using it. */ 295 /* If a proxy command is given, connect using it. */
305 if (proxy_command != NULL) 296 if (proxy_command != NULL)
306 return ssh_proxy_connect(host, port, proxy_command); 297 return ssh_proxy_connect(host, port, proxy_command);