summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:07:11 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:07:11 +0000
commitf9cedb9ca0c90652712b8e652d5ce740c903ee9b (patch)
treef0cfeb727591b32157c76c8d4e04764cf0140f4c /ssh.c
parentf9bedf1441832e9ab71dd69d83ec2c33774e83e8 (diff)
- markus@cvs.openbsd.org 2001/07/25 14:35:18
[readconf.c ssh.1 ssh.c sshconnect.c] cleanup connect(); connection_attempts 4 -> 1; from eivind@freebsd.org
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/ssh.c b/ssh.c
index 374630f71..7810cd14c 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.129 2001/07/11 16:29:59 markus Exp $"); 42RCSID("$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);
252int 252int
253main(int ac, char **av) 253main(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();