|
Lines 165-170
pid_t proxy_command_pid = 0;
Link Here
|
| 165 |
extern int muxserver_sock; |
165 |
extern int muxserver_sock; |
| 166 |
extern u_int muxclient_command; |
166 |
extern u_int muxclient_command; |
| 167 |
|
167 |
|
|
|
168 |
/* netcat */ |
| 169 |
static char *netcat_host; |
| 170 |
static int netcat_port; |
| 168 |
|
171 |
|
| 169 |
/* Prints a help message to the user. This function never returns. */ |
172 |
/* Prints a help message to the user. This function never returns. */ |
| 170 |
|
173 |
|
|
Lines 261-267
main(int ac, char **av)
Link Here
|
| 261 |
argv0 = av[0]; |
264 |
argv0 = av[0]; |
| 262 |
|
265 |
|
| 263 |
again: |
266 |
again: |
| 264 |
while ((opt = getopt(ac, av, "1246ab:c:e:fgi:kl:m:no:p:qstvx" |
267 |
while ((opt = getopt(ac, av, "1246ab:c:e:fgG:i:kl:m:no:p:qstvx" |
| 265 |
"ACD:F:I:KL:MNO:PR:S:TVw:XYy")) != -1) { |
268 |
"ACD:F:I:KL:MNO:PR:S:TVw:XYy")) != -1) { |
| 266 |
switch (opt) { |
269 |
switch (opt) { |
| 267 |
case '1': |
270 |
case '1': |
|
Lines 299-304
main(int ac, char **av)
Link Here
|
| 299 |
case 'g': |
302 |
case 'g': |
| 300 |
options.gateway_ports = 1; |
303 |
options.gateway_ports = 1; |
| 301 |
break; |
304 |
break; |
|
|
305 |
case 'G': |
| 306 |
if (parse_forward(&fwd, optarg, 1, 0)) { |
| 307 |
no_shell_flag = 1; |
| 308 |
no_tty_flag = 1; |
| 309 |
|
| 310 |
netcat_port = fwd.listen_port; |
| 311 |
netcat_host = fwd.listen_host; |
| 312 |
if (!netcat_host) |
| 313 |
netcat_host = "localhost"; |
| 314 |
} |
| 315 |
else { |
| 316 |
fprintf(stderr, |
| 317 |
"Bad remote address specification " |
| 318 |
"'%s'\n", optarg); |
| 319 |
exit(255); |
| 320 |
} |
| 321 |
break; |
| 302 |
case 'O': |
322 |
case 'O': |
| 303 |
if (strcmp(optarg, "check") == 0) |
323 |
if (strcmp(optarg, "check") == 0) |
| 304 |
muxclient_command = SSHMUX_COMMAND_ALIVE_CHECK; |
324 |
muxclient_command = SSHMUX_COMMAND_ALIVE_CHECK; |
|
Lines 799-804
main(int ac, char **av)
Link Here
|
| 799 |
} |
819 |
} |
| 800 |
} |
820 |
} |
| 801 |
|
821 |
|
|
|
822 |
if (netcat_host && !compat20) |
| 823 |
fatal("netcat feature not available for SSH1 connections"); |
| 824 |
|
| 802 |
exit_status = compat20 ? ssh_session2() : ssh_session(); |
825 |
exit_status = compat20 ? ssh_session2() : ssh_session(); |
| 803 |
packet_close(); |
826 |
packet_close(); |
| 804 |
|
827 |
|
|
Lines 1168-1173
ssh_session2_open(void)
Link Here
|
| 1168 |
} |
1191 |
} |
| 1169 |
|
1192 |
|
| 1170 |
static int |
1193 |
static int |
|
|
1194 |
ssh_netcat_open(void) { |
| 1195 |
int in, out, id; |
| 1196 |
|
| 1197 |
in = (stdin_null_flag ? open(_PATH_DEVNULL, O_RDONLY) : dup(STDIN_FILENO)); |
| 1198 |
out = dup(STDOUT_FILENO); |
| 1199 |
|
| 1200 |
if (in < 0 || out < 0) |
| 1201 |
fatal("dup() in/out failed"); |
| 1202 |
|
| 1203 |
if (!isatty(in)) |
| 1204 |
set_nonblock(in); |
| 1205 |
if (!isatty(out)) |
| 1206 |
set_nonblock(out); |
| 1207 |
|
| 1208 |
id = channel_setup_netcat(netcat_host, netcat_port, in, out); |
| 1209 |
|
| 1210 |
debug3("ssh_netcat_open: channel_new: %d", id); |
| 1211 |
|
| 1212 |
return id; |
| 1213 |
} |
| 1214 |
|
| 1215 |
static int |
| 1171 |
ssh_session2(void) |
1216 |
ssh_session2(void) |
| 1172 |
{ |
1217 |
{ |
| 1173 |
int id = -1; |
1218 |
int id = -1; |
|
Lines 1177-1182
ssh_session2(void)
Link Here
|
| 1177 |
|
1222 |
|
| 1178 |
if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN)) |
1223 |
if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN)) |
| 1179 |
id = ssh_session2_open(); |
1224 |
id = ssh_session2_open(); |
|
|
1225 |
if (netcat_host) |
| 1226 |
id = ssh_netcat_open(); |
| 1180 |
|
1227 |
|
| 1181 |
/* If we don't expect to open a new session, then disallow it */ |
1228 |
/* If we don't expect to open a new session, then disallow it */ |
| 1182 |
if (options.control_master == SSHCTL_MASTER_NO && |
1229 |
if (options.control_master == SSHCTL_MASTER_NO && |