version 1.522, 2020/04/03 02:27:12 |
version 1.523, 2020/04/03 02:40:32 |
|
|
int subsystem_flag = 0; |
int subsystem_flag = 0; |
|
|
/* # of replies received for global requests */ |
/* # of replies received for global requests */ |
static int remote_forward_confirms_received = 0; |
static int forward_confirms_pending = -1; |
|
|
/* mux.c */ |
/* mux.c */ |
extern int muxserver_sock; |
extern int muxserver_sock; |
|
|
fatal("daemon() failed: %.200s", strerror(errno)); |
fatal("daemon() failed: %.200s", strerror(errno)); |
} |
} |
|
|
|
static void |
|
forwarding_success(void) |
|
{ |
|
if (forward_confirms_pending > 0 && --forward_confirms_pending == 0) { |
|
debug("All forwarding requests processed"); |
|
if (fork_after_authentication_flag) |
|
fork_postauth(); |
|
} |
|
} |
|
|
/* Callback for remote forward global requests */ |
/* Callback for remote forward global requests */ |
static void |
static void |
ssh_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) |
ssh_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) |
|
|
"for listen port %d", rfwd->listen_port); |
"for listen port %d", rfwd->listen_port); |
} |
} |
} |
} |
if (++remote_forward_confirms_received == options.num_remote_forwards) { |
forwarding_success(); |
debug("All remote forwarding requests processed"); |
|
if (fork_after_authentication_flag) |
|
fork_postauth(); |
|
} |
|
} |
} |
|
|
static void |
static void |
|
|
} |
} |
|
|
static void |
static void |
|
ssh_tun_confirm(struct ssh *ssh, int id, int success, void *arg) |
|
{ |
|
if (!success) { |
|
error("Tunnel forwarding failed"); |
|
if (options.exit_on_forward_failure) |
|
cleanup_exit(255); |
|
} |
|
|
|
debug("%s: tunnel forward established, id=%d", __func__, id); |
|
forwarding_success(); |
|
} |
|
|
|
static void |
ssh_init_stdio_forwarding(struct ssh *ssh) |
ssh_init_stdio_forwarding(struct ssh *ssh) |
{ |
{ |
Channel *c; |
Channel *c; |
|
|
options.remote_forwards[i].connect_path : |
options.remote_forwards[i].connect_path : |
options.remote_forwards[i].connect_host, |
options.remote_forwards[i].connect_host, |
options.remote_forwards[i].connect_port); |
options.remote_forwards[i].connect_port); |
options.remote_forwards[i].handle = |
if ((options.remote_forwards[i].handle = |
channel_request_remote_forwarding(ssh, |
channel_request_remote_forwarding(ssh, |
&options.remote_forwards[i]); |
&options.remote_forwards[i])) >= 0) { |
if (options.remote_forwards[i].handle < 0) { |
|
if (options.exit_on_forward_failure) |
|
fatal("Could not request remote forwarding."); |
|
else |
|
logit("Warning: Could not request remote " |
|
"forwarding."); |
|
} else { |
|
client_register_global_confirm( |
client_register_global_confirm( |
ssh_confirm_remote_forward, |
ssh_confirm_remote_forward, |
&options.remote_forwards[i]); |
&options.remote_forwards[i]); |
} |
forward_confirms_pending++; |
|
} else if (options.exit_on_forward_failure) |
|
fatal("Could not request remote forwarding."); |
|
else |
|
logit("Warning: Could not request remote forwarding."); |
} |
} |
|
|
/* Initiate tunnel forwarding. */ |
/* Initiate tunnel forwarding. */ |
if (options.tun_open != SSH_TUNMODE_NO) { |
if (options.tun_open != SSH_TUNMODE_NO) { |
if ((*ifname = client_request_tun_fwd(ssh, |
if ((*ifname = client_request_tun_fwd(ssh, |
options.tun_open, options.tun_local, |
options.tun_open, options.tun_local, |
options.tun_remote)) == NULL) { |
options.tun_remote, ssh_tun_confirm, NULL)) != NULL) |
if (options.exit_on_forward_failure) |
forward_confirms_pending++; |
fatal("Could not request tunnel forwarding."); |
else if (options.exit_on_forward_failure) |
else |
fatal("Could not request tunnel forwarding."); |
error("Could not request tunnel forwarding."); |
else |
} |
error("Could not request tunnel forwarding."); |
} |
} |
} |
} |
|
|