diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.302 2007/09/04 03:21:03 djm Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.303 2007/09/04 11:15:55 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -210,7 +210,7 @@ main(int ac, char **av) | |||
210 | char *p, *cp, *line, buf[256]; | 210 | char *p, *cp, *line, buf[256]; |
211 | struct stat st; | 211 | struct stat st; |
212 | struct passwd *pw; | 212 | struct passwd *pw; |
213 | int dummy; | 213 | int dummy, timeout_ms; |
214 | extern int optind, optreset; | 214 | extern int optind, optreset; |
215 | extern char *optarg; | 215 | extern char *optarg; |
216 | struct servent *sp; | 216 | struct servent *sp; |
@@ -681,9 +681,12 @@ main(int ac, char **av) | |||
681 | if (options.control_path != NULL) | 681 | if (options.control_path != NULL) |
682 | control_client(options.control_path); | 682 | control_client(options.control_path); |
683 | 683 | ||
684 | timeout_ms = options.connection_timeout * 1000; | ||
685 | |||
684 | /* Open a connection to the remote host. */ | 686 | /* Open a connection to the remote host. */ |
685 | if (ssh_connect(host, &hostaddr, options.port, | 687 | if (ssh_connect(host, &hostaddr, options.port, |
686 | options.address_family, options.connection_attempts, | 688 | options.address_family, options.connection_attempts, &timeout_ms, |
689 | options.tcp_keep_alive, | ||
687 | #ifdef HAVE_CYGWIN | 690 | #ifdef HAVE_CYGWIN |
688 | options.use_privileged_port, | 691 | options.use_privileged_port, |
689 | #else | 692 | #else |
@@ -692,6 +695,9 @@ main(int ac, char **av) | |||
692 | options.proxy_command) != 0) | 695 | options.proxy_command) != 0) |
693 | exit(255); | 696 | exit(255); |
694 | 697 | ||
698 | if (timeout_ms > 0) | ||
699 | debug3("timeout: %d ms remain after connect", timeout_ms); | ||
700 | |||
695 | /* | 701 | /* |
696 | * If we successfully made the connection, load the host private key | 702 | * If we successfully made the connection, load the host private key |
697 | * in case we will need it later for combined rsa-rhosts | 703 | * in case we will need it later for combined rsa-rhosts |
@@ -767,7 +773,8 @@ main(int ac, char **av) | |||
767 | signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */ | 773 | signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE early */ |
768 | 774 | ||
769 | /* Log into the remote system. This never returns if the login fails. */ | 775 | /* Log into the remote system. This never returns if the login fails. */ |
770 | ssh_login(&sensitive_data, host, (struct sockaddr *)&hostaddr, pw); | 776 | ssh_login(&sensitive_data, host, (struct sockaddr *)&hostaddr, |
777 | pw, timeout_ms); | ||
771 | 778 | ||
772 | /* We no longer need the private host keys. Clear them now. */ | 779 | /* We no longer need the private host keys. Clear them now. */ |
773 | if (sensitive_data.nkeys != 0) { | 780 | if (sensitive_data.nkeys != 0) { |