version 1.203, 2008/11/01 17:40:33 |
version 1.204, 2008/11/05 03:23:09 |
|
|
void (*handler)(int); |
void (*handler)(int); |
char *s, *cmd, *cancel_host; |
char *s, *cmd, *cancel_host; |
int delete = 0; |
int delete = 0; |
int local = 0; |
int local = 0, remote = 0, dynamic = 0; |
u_short cancel_port; |
u_short cancel_port; |
Forward fwd; |
Forward fwd; |
|
|
|
|
"Request local forward"); |
"Request local forward"); |
logit(" -R[bind_address:]port:host:hostport " |
logit(" -R[bind_address:]port:host:hostport " |
"Request remote forward"); |
"Request remote forward"); |
|
logit(" -D[bind_address:]port " |
|
"Request dynamic forward"); |
logit(" -KR[bind_address:]port " |
logit(" -KR[bind_address:]port " |
"Cancel remote forward"); |
"Cancel remote forward"); |
if (!options.permit_local_command) |
if (!options.permit_local_command) |
|
|
delete = 1; |
delete = 1; |
s++; |
s++; |
} |
} |
if (*s != 'L' && *s != 'R') { |
if (*s == 'L') |
|
local = 1; |
|
else if (*s == 'R') |
|
remote = 1; |
|
else if (*s == 'D') |
|
dynamic = 1; |
|
else { |
logit("Invalid command."); |
logit("Invalid command."); |
goto out; |
goto out; |
} |
} |
if (*s == 'L') |
|
local = 1; |
if ((local || dynamic) && delete) { |
if (local && delete) { |
|
logit("Not supported."); |
logit("Not supported."); |
goto out; |
goto out; |
} |
} |
if ((!local || delete) && !compat20) { |
if (remote && delete && !compat20) { |
logit("Not supported for SSH protocol version 1."); |
logit("Not supported for SSH protocol version 1."); |
goto out; |
goto out; |
} |
} |
|
|
} |
} |
channel_request_rforward_cancel(cancel_host, cancel_port); |
channel_request_rforward_cancel(cancel_host, cancel_port); |
} else { |
} else { |
if (!parse_forward(&fwd, s, 0)) { |
if (!parse_forward(&fwd, s, dynamic ? 1 : 0)) { |
logit("Bad forwarding specification."); |
logit("Bad forwarding specification."); |
goto out; |
goto out; |
} |
} |
if (local) { |
if (local || dynamic) { |
if (channel_setup_local_fwd_listener(fwd.listen_host, |
if (channel_setup_local_fwd_listener(fwd.listen_host, |
fwd.listen_port, fwd.connect_host, |
fwd.listen_port, fwd.connect_host, |
fwd.connect_port, options.gateway_ports) < 0) { |
fwd.connect_port, options.gateway_ports) < 0) { |