|
Lines 175-181
struct sshbuf *command;
Link Here
|
| 175 |
int subsystem_flag = 0; |
175 |
int subsystem_flag = 0; |
| 176 |
|
176 |
|
| 177 |
/* # of replies received for global requests */ |
177 |
/* # of replies received for global requests */ |
| 178 |
static int remote_forward_confirms_received = 0; |
178 |
static int forward_confirms_pending = -1; |
| 179 |
|
179 |
|
| 180 |
/* mux.c */ |
180 |
/* mux.c */ |
| 181 |
extern int muxserver_sock; |
181 |
extern int muxserver_sock; |
|
Lines 1640-1645
fork_postauth(void)
Link Here
|
| 1640 |
fatal("daemon() failed: %.200s", strerror(errno)); |
1640 |
fatal("daemon() failed: %.200s", strerror(errno)); |
| 1641 |
} |
1641 |
} |
| 1642 |
|
1642 |
|
|
|
1643 |
static void |
| 1644 |
forwarding_success(void) |
| 1645 |
{ |
| 1646 |
if (forward_confirms_pending > 0 && --forward_confirms_pending == 0) { |
| 1647 |
debug("All forwarding requests processed"); |
| 1648 |
if (fork_after_authentication_flag) |
| 1649 |
fork_postauth(); |
| 1650 |
} |
| 1651 |
} |
| 1652 |
|
| 1643 |
/* Callback for remote forward global requests */ |
1653 |
/* Callback for remote forward global requests */ |
| 1644 |
static void |
1654 |
static void |
| 1645 |
ssh_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) |
1655 |
ssh_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt) |
|
Lines 1699-1709
ssh_confirm_remote_forward(struct ssh *ssh, int type, u_int32_t seq, void *ctxt)
Link Here
|
| 1699 |
"for listen port %d", rfwd->listen_port); |
1709 |
"for listen port %d", rfwd->listen_port); |
| 1700 |
} |
1710 |
} |
| 1701 |
} |
1711 |
} |
| 1702 |
if (++remote_forward_confirms_received == options.num_remote_forwards) { |
1712 |
forwarding_success(); |
| 1703 |
debug("All remote forwarding requests processed"); |
|
|
| 1704 |
if (fork_after_authentication_flag) |
| 1705 |
fork_postauth(); |
| 1706 |
} |
| 1707 |
} |
1713 |
} |
| 1708 |
|
1714 |
|
| 1709 |
static void |
1715 |
static void |
|
Lines 1720-1725
ssh_stdio_confirm(struct ssh *ssh, int id, int success, void *arg)
Link Here
|
| 1720 |
fatal("stdio forwarding failed"); |
1726 |
fatal("stdio forwarding failed"); |
| 1721 |
} |
1727 |
} |
| 1722 |
|
1728 |
|
|
|
1729 |
static void |
| 1730 |
ssh_tun_confirm(struct ssh *ssh, int id, int success, void *arg) |
| 1731 |
{ |
| 1732 |
if (!success) { |
| 1733 |
error("Tunnel forwarding failed"); |
| 1734 |
if (options.exit_on_forward_failure) |
| 1735 |
cleanup_exit(255); |
| 1736 |
} |
| 1737 |
|
| 1738 |
debug("%s: tunnel forward established, id=%d", __func__, id); |
| 1739 |
forwarding_success(); |
| 1740 |
} |
| 1741 |
|
| 1723 |
static void |
1742 |
static void |
| 1724 |
ssh_init_stdio_forwarding(struct ssh *ssh) |
1743 |
ssh_init_stdio_forwarding(struct ssh *ssh) |
| 1725 |
{ |
1744 |
{ |
|
Lines 1783-1814
ssh_init_forwarding(struct ssh *ssh, char **ifname)
Link Here
|
| 1783 |
options.remote_forwards[i].connect_path : |
1802 |
options.remote_forwards[i].connect_path : |
| 1784 |
options.remote_forwards[i].connect_host, |
1803 |
options.remote_forwards[i].connect_host, |
| 1785 |
options.remote_forwards[i].connect_port); |
1804 |
options.remote_forwards[i].connect_port); |
| 1786 |
options.remote_forwards[i].handle = |
1805 |
if ((options.remote_forwards[i].handle = |
| 1787 |
channel_request_remote_forwarding(ssh, |
1806 |
channel_request_remote_forwarding(ssh, |
| 1788 |
&options.remote_forwards[i]); |
1807 |
&options.remote_forwards[i])) >= 0) { |
| 1789 |
if (options.remote_forwards[i].handle < 0) { |
|
|
| 1790 |
if (options.exit_on_forward_failure) |
| 1791 |
fatal("Could not request remote forwarding."); |
| 1792 |
else |
| 1793 |
logit("Warning: Could not request remote " |
| 1794 |
"forwarding."); |
| 1795 |
} else { |
| 1796 |
client_register_global_confirm( |
1808 |
client_register_global_confirm( |
| 1797 |
ssh_confirm_remote_forward, |
1809 |
ssh_confirm_remote_forward, |
| 1798 |
&options.remote_forwards[i]); |
1810 |
&options.remote_forwards[i]); |
| 1799 |
} |
1811 |
forward_confirms_pending++; |
|
|
1812 |
} else if (options.exit_on_forward_failure) |
| 1813 |
fatal("Could not request remote forwarding."); |
| 1814 |
else |
| 1815 |
logit("Warning: Could not request remote forwarding."); |
| 1800 |
} |
1816 |
} |
| 1801 |
|
1817 |
|
| 1802 |
/* Initiate tunnel forwarding. */ |
1818 |
/* Initiate tunnel forwarding. */ |
| 1803 |
if (options.tun_open != SSH_TUNMODE_NO) { |
1819 |
if (options.tun_open != SSH_TUNMODE_NO) { |
| 1804 |
if ((*ifname = client_request_tun_fwd(ssh, |
1820 |
if ((*ifname = client_request_tun_fwd(ssh, |
| 1805 |
options.tun_open, options.tun_local, |
1821 |
options.tun_open, options.tun_local, |
| 1806 |
options.tun_remote)) == NULL) { |
1822 |
options.tun_remote, ssh_tun_confirm, NULL)) != NULL) |
| 1807 |
if (options.exit_on_forward_failure) |
1823 |
forward_confirms_pending++; |
| 1808 |
fatal("Could not request tunnel forwarding."); |
1824 |
else if (options.exit_on_forward_failure) |
| 1809 |
else |
1825 |
fatal("Could not request tunnel forwarding."); |
| 1810 |
error("Could not request tunnel forwarding."); |
1826 |
else |
| 1811 |
} |
1827 |
error("Could not request tunnel forwarding."); |
| 1812 |
} |
1828 |
} |
| 1813 |
} |
1829 |
} |
| 1814 |
|
1830 |
|