version 1.129, 2001/07/11 16:29:59 |
version 1.130, 2001/07/25 14:35:18 |
|
|
int |
int |
main(int ac, char **av) |
main(int ac, char **av) |
{ |
{ |
int i, opt, exit_status, ok; |
int i, opt, exit_status, cerr; |
u_short fwd_port, fwd_host_port; |
u_short fwd_port, fwd_host_port; |
char *p, *cp, buf[256]; |
char *p, *cp, buf[256]; |
struct stat st; |
struct stat st; |
|
|
|
|
/* Open a connection to the remote host. */ |
/* Open a connection to the remote host. */ |
|
|
ok = ssh_connect(host, &hostaddr, options.port, |
cerr = ssh_connect(host, &hostaddr, options.port, |
options.connection_attempts, |
options.connection_attempts, |
original_effective_uid != 0 || !options.use_privileged_port, |
original_effective_uid != 0 || !options.use_privileged_port, |
pw, options.proxy_command); |
pw, options.proxy_command); |
|
|
*/ |
*/ |
sensitive_data.nkeys = 0; |
sensitive_data.nkeys = 0; |
sensitive_data.keys = NULL; |
sensitive_data.keys = NULL; |
if (ok && (options.rhosts_rsa_authentication || |
if (!cerr && (options.rhosts_rsa_authentication || |
options.hostbased_authentication)) { |
options.hostbased_authentication)) { |
sensitive_data.nkeys = 3; |
sensitive_data.nkeys = 3; |
sensitive_data.keys = xmalloc(sensitive_data.nkeys*sizeof(Key)); |
sensitive_data.keys = xmalloc(sensitive_data.nkeys*sizeof(Key)); |
|
|
error("Could not create directory '%.200s'.", buf); |
error("Could not create directory '%.200s'.", buf); |
|
|
/* Check if the connection failed, and try "rsh" if appropriate. */ |
/* Check if the connection failed, and try "rsh" if appropriate. */ |
if (!ok) { |
if (cerr) { |
|
if (!options.fallback_to_rsh) |
|
exit(1); |
if (options.port != 0) |
if (options.port != 0) |
log("Secure connection to %.100s on port %hu refused%.100s.", |
log("Secure connection to %.100s on port %hu refused; " |
host, options.port, |
"reverting to insecure method", |
options.fallback_to_rsh ? "; reverting to insecure method" : ""); |
host, options.port); |
else |
else |
log("Secure connection to %.100s refused%.100s.", host, |
log("Secure connection to %.100s refused; " |
options.fallback_to_rsh ? "; reverting to insecure method" : ""); |
"reverting to insecure method.", host); |
|
|
if (options.fallback_to_rsh) { |
rsh_connect(host, options.user, &command); |
rsh_connect(host, options.user, &command); |
fatal("rsh_connect returned"); |
fatal("rsh_connect returned"); |
|
} |
|
exit(1); |
|
} |
} |
/* load options.identity_files */ |
/* load options.identity_files */ |
load_public_identity_files(); |
load_public_identity_files(); |