version 1.34, 1999/11/24 20:15:35 |
version 1.35, 1999/12/01 13:59:15 |
|
|
int |
int |
main(int ac, char **av) |
main(int ac, char **av) |
{ |
{ |
int i, opt, optind, type, exit_status, ok, fwd_port, fwd_host_port, |
int i, opt, optind, type, exit_status, ok, authfd; |
authfd; |
u_short fwd_port, fwd_host_port; |
char *optarg, *cp, buf[256]; |
char *optarg, *cp, buf[256]; |
Buffer command; |
Buffer command; |
struct winsize ws; |
struct winsize ws; |
|
|
|
|
case 'p': |
case 'p': |
options.port = atoi(optarg); |
options.port = atoi(optarg); |
if (options.port < 1 || options.port > 65535) { |
|
fprintf(stderr, "Bad port %s.\n", optarg); |
|
exit(1); |
|
} |
|
break; |
break; |
|
|
case 'l': |
case 'l': |
|
|
break; |
break; |
|
|
case 'R': |
case 'R': |
if (sscanf(optarg, "%d:%255[^:]:%d", &fwd_port, buf, |
if (sscanf(optarg, "%hu:%255[^:]:%hu", &fwd_port, buf, |
&fwd_host_port) != 3) { |
&fwd_host_port) != 3) { |
fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg); |
fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg); |
usage(); |
usage(); |
|
|
break; |
break; |
|
|
case 'L': |
case 'L': |
if (sscanf(optarg, "%d:%255[^:]:%d", &fwd_port, buf, |
if (sscanf(optarg, "%hu:%255[^:]:%hu", &fwd_port, buf, |
&fwd_host_port) != 3) { |
&fwd_host_port) != 3) { |
fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg); |
fprintf(stderr, "Bad forwarding specification '%s'.\n", optarg); |
usage(); |
usage(); |
|
|
/* Check if the connection failed, and try "rsh" if appropriate. */ |
/* Check if the connection failed, and try "rsh" if appropriate. */ |
if (!ok) { |
if (!ok) { |
if (options.port != 0) |
if (options.port != 0) |
log("Secure connection to %.100s on port %d refused%.100s.", |
log("Secure connection to %.100s on port %hu refused%.100s.", |
host, options.port, |
host, options.port, |
options.fallback_to_rsh ? "; reverting to insecure method" : ""); |
options.fallback_to_rsh ? "; reverting to insecure method" : ""); |
else |
else |