version 1.236, 2011/06/22 22:08:42 |
version 1.237, 2011/09/10 22:26:34 |
|
|
{ |
{ |
void (*handler)(int); |
void (*handler)(int); |
char *s, *cmd, *cancel_host; |
char *s, *cmd, *cancel_host; |
int delete = 0; |
int delete = 0, local = 0, remote = 0, dynamic = 0; |
int local = 0, remote = 0, dynamic = 0; |
int cancel_port, ok; |
int cancel_port; |
|
Forward fwd; |
Forward fwd; |
|
|
bzero(&fwd, sizeof(fwd)); |
bzero(&fwd, sizeof(fwd)); |
|
|
"Request remote forward"); |
"Request remote forward"); |
logit(" -D[bind_address:]port " |
logit(" -D[bind_address:]port " |
"Request dynamic forward"); |
"Request dynamic forward"); |
|
logit(" -KL[bind_address:]port " |
|
"Cancel local forward"); |
logit(" -KR[bind_address:]port " |
logit(" -KR[bind_address:]port " |
"Cancel remote forward"); |
"Cancel remote forward"); |
|
logit(" -KD[bind_address:]port " |
|
"Cancel dynamic forward"); |
if (!options.permit_local_command) |
if (!options.permit_local_command) |
goto out; |
goto out; |
logit(" !args " |
logit(" !args " |
|
|
goto out; |
goto out; |
} |
} |
|
|
if ((local || dynamic) && delete) { |
if (delete && !compat20) { |
logit("Not supported."); |
|
goto out; |
|
} |
|
if (remote && delete && !compat20) { |
|
logit("Not supported for SSH protocol version 1."); |
logit("Not supported for SSH protocol version 1."); |
goto out; |
goto out; |
} |
} |
|
|
logit("Bad forwarding close port"); |
logit("Bad forwarding close port"); |
goto out; |
goto out; |
} |
} |
channel_request_rforward_cancel(cancel_host, cancel_port); |
if (remote) |
|
ok = channel_request_rforward_cancel(cancel_host, |
|
cancel_port) == 0; |
|
else if (dynamic) |
|
ok = channel_cancel_lport_listener(cancel_host, |
|
cancel_port, 0, options.gateway_ports) > 0; |
|
else |
|
ok = channel_cancel_lport_listener(cancel_host, |
|
cancel_port, CHANNEL_CANCEL_PORT_STATIC, |
|
options.gateway_ports) > 0; |
|
if (!ok) { |
|
logit("Unkown port forwarding."); |
|
goto out; |
|
} |
|
logit("Canceled forwarding."); |
} else { |
} else { |
if (!parse_forward(&fwd, s, dynamic, remote)) { |
if (!parse_forward(&fwd, s, dynamic, remote)) { |
logit("Bad forwarding specification."); |
logit("Bad forwarding specification."); |
|
|
goto out; |
goto out; |
} |
} |
} |
} |
|
|
logit("Forwarding port."); |
logit("Forwarding port."); |
} |
} |
|
|