version 1.47, 2000/04/14 10:11:12 |
version 1.48, 2000/04/14 10:30:33 |
|
|
if (host) |
if (host) |
break; |
break; |
if ((cp = strchr(av[optind], '@'))) { |
if ((cp = strchr(av[optind], '@'))) { |
if(cp == av[optind]) |
if(cp == av[optind]) |
usage(); |
usage(); |
options.user = av[optind]; |
options.user = av[optind]; |
*cp = '\0'; |
*cp = '\0'; |
host = ++cp; |
host = ++cp; |
|
|
case '2': |
case '2': |
options.protocol = SSH_PROTO_2; |
options.protocol = SSH_PROTO_2; |
break; |
break; |
|
|
case '4': |
case '4': |
IPv4or6 = AF_INET; |
IPv4or6 = AF_INET; |
break; |
break; |
|
|
case '6': |
case '6': |
IPv4or6 = AF_INET6; |
IPv4or6 = AF_INET6; |
break; |
break; |
|
|
case 'n': |
case 'n': |
stdin_null_flag = 1; |
stdin_null_flag = 1; |
break; |
break; |
|
|
case 'f': |
case 'f': |
fork_after_authentication_flag = 1; |
fork_after_authentication_flag = 1; |
stdin_null_flag = 1; |
stdin_null_flag = 1; |
break; |
break; |
|
|
case 'x': |
case 'x': |
options.forward_x11 = 0; |
options.forward_x11 = 0; |
break; |
break; |
|
|
case 'X': |
case 'X': |
options.forward_x11 = 1; |
options.forward_x11 = 1; |
break; |
break; |
|
|
case 'g': |
case 'g': |
options.gateway_ports = 1; |
options.gateway_ports = 1; |
break; |
break; |
|
|
case 'P': |
case 'P': |
options.use_privileged_port = 0; |
options.use_privileged_port = 0; |
break; |
break; |
|
|
case 'a': |
case 'a': |
options.forward_agent = 0; |
options.forward_agent = 0; |
break; |
break; |
|
|
options.identity_files[options.num_identity_files++] = |
options.identity_files[options.num_identity_files++] = |
xstrdup(optarg); |
xstrdup(optarg); |
break; |
break; |
|
|
case 't': |
case 't': |
tty_flag = 1; |
tty_flag = 1; |
break; |
break; |
|
|
case 'v': |
case 'v': |
case 'V': |
case 'V': |
fprintf(stderr, "SSH Version %s, protocol versions %d.%d/%d.%d.\n", |
fprintf(stderr, "SSH Version %s, protocol versions %d.%d/%d.%d.\n", |
|
|
debug_flag = 1; |
debug_flag = 1; |
options.log_level = SYSLOG_LEVEL_DEBUG; |
options.log_level = SYSLOG_LEVEL_DEBUG; |
break; |
break; |
|
|
case 'q': |
case 'q': |
options.log_level = SYSLOG_LEVEL_QUIET; |
options.log_level = SYSLOG_LEVEL_QUIET; |
break; |
break; |
|
|
case 'e': |
case 'e': |
if (optarg[0] == '^' && optarg[2] == 0 && |
if (optarg[0] == '^' && optarg[2] == 0 && |
(unsigned char) optarg[1] >= 64 && (unsigned char) optarg[1] < 128) |
(unsigned char) optarg[1] >= 64 && (unsigned char) optarg[1] < 128) |
|
|
exit(1); |
exit(1); |
} |
} |
break; |
break; |
|
|
case 'c': |
case 'c': |
options.cipher = cipher_number(optarg); |
options.cipher = cipher_number(optarg); |
if (options.cipher == -1) { |
if (options.cipher == -1) { |
|
|
exit(1); |
exit(1); |
} |
} |
break; |
break; |
|
|
case 'p': |
case 'p': |
options.port = atoi(optarg); |
options.port = atoi(optarg); |
break; |
break; |
|
|
case 'l': |
case 'l': |
options.user = optarg; |
options.user = optarg; |
break; |
break; |
|
|
case 'R': |
case 'R': |
if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, |
if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, |
&fwd_host_port) != 3 && |
&fwd_host_port) != 3 && |
|
|
} |
} |
add_remote_forward(&options, fwd_port, buf, fwd_host_port); |
add_remote_forward(&options, fwd_port, buf, fwd_host_port); |
break; |
break; |
|
|
case 'L': |
case 'L': |
if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, |
if (sscanf(optarg, "%hu/%255[^/]/%hu", &fwd_port, buf, |
&fwd_host_port) != 3 && |
&fwd_host_port) != 3 && |
|
|
} |
} |
add_local_forward(&options, fwd_port, buf, fwd_host_port); |
add_local_forward(&options, fwd_port, buf, fwd_host_port); |
break; |
break; |
|
|
case 'C': |
case 'C': |
options.compression = 1; |
options.compression = 1; |
break; |
break; |
|
|
case 'N': |
case 'N': |
no_shell_flag = 1; |
no_shell_flag = 1; |
no_tty_flag = 1; |
no_tty_flag = 1; |
break; |
break; |
|
|
case 'T': |
case 'T': |
no_tty_flag = 1; |
no_tty_flag = 1; |
break; |
break; |
|
|
case 'o': |
case 'o': |
dummy = 1; |
dummy = 1; |
if (process_config_line(&options, host ? host : "", optarg, |
if (process_config_line(&options, host ? host : "", optarg, |
"command-line", 0, &dummy) != 0) |
"command-line", 0, &dummy) != 0) |
exit(1); |
exit(1); |
break; |
break; |
|
|
default: |
default: |
usage(); |
usage(); |
} |
} |
|
|
|
|
/* Expand ~ in known host file names. */ |
/* Expand ~ in known host file names. */ |
options.system_hostfile = tilde_expand_filename(options.system_hostfile, |
options.system_hostfile = tilde_expand_filename(options.system_hostfile, |
original_real_uid); |
original_real_uid); |
options.user_hostfile = tilde_expand_filename(options.user_hostfile, |
options.user_hostfile = tilde_expand_filename(options.user_hostfile, |
original_real_uid); |
original_real_uid); |
|
|
|
|
options.local_forwards[i].host, |
options.local_forwards[i].host, |
options.local_forwards[i].host_port); |
options.local_forwards[i].host_port); |
channel_request_local_forwarding(options.local_forwards[i].port, |
channel_request_local_forwarding(options.local_forwards[i].port, |
options.local_forwards[i].host, |
options.local_forwards[i].host, |
options.local_forwards[i].host_port, |
options.local_forwards[i].host_port, |
options.gateway_ports); |
options.gateway_ports); |
} |
} |
|
|
options.remote_forwards[i].host_port); |
options.remote_forwards[i].host_port); |
channel_request_remote_forwarding(options.remote_forwards[i].port, |
channel_request_remote_forwarding(options.remote_forwards[i].port, |
options.remote_forwards[i].host, |
options.remote_forwards[i].host, |
options.remote_forwards[i].host_port); |
options.remote_forwards[i].host_port); |
} |
} |
|
|
/* If requested, let ssh continue in the background. */ |
/* If requested, let ssh continue in the background. */ |
if (fork_after_authentication_flag) |
if (fork_after_authentication_flag) |
if (daemon(1, 1) < 0) |
if (daemon(1, 1) < 0) |
fatal("daemon() failed: %.200s", strerror(errno)); |
fatal("daemon() failed: %.200s", strerror(errno)); |
|
|
|
|
options.local_forwards[i].host, |
options.local_forwards[i].host, |
options.local_forwards[i].host_port); |
options.local_forwards[i].host_port); |
channel_request_local_forwarding(options.local_forwards[i].port, |
channel_request_local_forwarding(options.local_forwards[i].port, |
options.local_forwards[i].host, |
options.local_forwards[i].host, |
options.local_forwards[i].host_port, |
options.local_forwards[i].host_port, |
options.gateway_ports); |
options.gateway_ports); |
} |
} |