diff options
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -39,7 +39,7 @@ | |||
39 | */ | 39 | */ |
40 | 40 | ||
41 | #include "includes.h" | 41 | #include "includes.h" |
42 | RCSID("$OpenBSD: ssh.c,v 1.129 2001/07/11 16:29:59 markus Exp $"); | 42 | RCSID("$OpenBSD: ssh.c,v 1.130 2001/07/25 14:35:18 markus Exp $"); |
43 | 43 | ||
44 | #include <openssl/evp.h> | 44 | #include <openssl/evp.h> |
45 | #include <openssl/err.h> | 45 | #include <openssl/err.h> |
@@ -252,7 +252,7 @@ static void load_public_identity_files(void); | |||
252 | int | 252 | int |
253 | main(int ac, char **av) | 253 | main(int ac, char **av) |
254 | { | 254 | { |
255 | int i, opt, exit_status, ok; | 255 | int i, opt, exit_status, cerr; |
256 | u_short fwd_port, fwd_host_port; | 256 | u_short fwd_port, fwd_host_port; |
257 | char *p, *cp, buf[256]; | 257 | char *p, *cp, buf[256]; |
258 | struct stat st; | 258 | struct stat st; |
@@ -666,7 +666,7 @@ again: | |||
666 | 666 | ||
667 | /* Open a connection to the remote host. */ | 667 | /* Open a connection to the remote host. */ |
668 | 668 | ||
669 | ok = ssh_connect(host, &hostaddr, options.port, | 669 | cerr = ssh_connect(host, &hostaddr, options.port, |
670 | options.connection_attempts, | 670 | options.connection_attempts, |
671 | original_effective_uid != 0 || !options.use_privileged_port, | 671 | original_effective_uid != 0 || !options.use_privileged_port, |
672 | pw, options.proxy_command); | 672 | pw, options.proxy_command); |
@@ -679,7 +679,7 @@ again: | |||
679 | */ | 679 | */ |
680 | sensitive_data.nkeys = 0; | 680 | sensitive_data.nkeys = 0; |
681 | sensitive_data.keys = NULL; | 681 | sensitive_data.keys = NULL; |
682 | if (ok && (options.rhosts_rsa_authentication || | 682 | if (!cerr && (options.rhosts_rsa_authentication || |
683 | options.hostbased_authentication)) { | 683 | options.hostbased_authentication)) { |
684 | sensitive_data.nkeys = 3; | 684 | sensitive_data.nkeys = 3; |
685 | sensitive_data.keys = xmalloc(sensitive_data.nkeys*sizeof(Key)); | 685 | sensitive_data.keys = xmalloc(sensitive_data.nkeys*sizeof(Key)); |
@@ -717,20 +717,19 @@ again: | |||
717 | error("Could not create directory '%.200s'.", buf); | 717 | error("Could not create directory '%.200s'.", buf); |
718 | 718 | ||
719 | /* Check if the connection failed, and try "rsh" if appropriate. */ | 719 | /* Check if the connection failed, and try "rsh" if appropriate. */ |
720 | if (!ok) { | 720 | if (cerr) { |
721 | if (!options.fallback_to_rsh) | ||
722 | exit(1); | ||
721 | if (options.port != 0) | 723 | if (options.port != 0) |
722 | log("Secure connection to %.100s on port %hu refused%.100s.", | 724 | log("Secure connection to %.100s on port %hu refused; " |
723 | host, options.port, | 725 | "reverting to insecure method", |
724 | options.fallback_to_rsh ? "; reverting to insecure method" : ""); | 726 | host, options.port); |
725 | else | 727 | else |
726 | log("Secure connection to %.100s refused%.100s.", host, | 728 | log("Secure connection to %.100s refused; " |
727 | options.fallback_to_rsh ? "; reverting to insecure method" : ""); | 729 | "reverting to insecure method.", host); |
728 | 730 | ||
729 | if (options.fallback_to_rsh) { | 731 | rsh_connect(host, options.user, &command); |
730 | rsh_connect(host, options.user, &command); | 732 | fatal("rsh_connect returned"); |
731 | fatal("rsh_connect returned"); | ||
732 | } | ||
733 | exit(1); | ||
734 | } | 733 | } |
735 | /* load options.identity_files */ | 734 | /* load options.identity_files */ |
736 | load_public_identity_files(); | 735 | load_public_identity_files(); |