summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c44
1 files changed, 15 insertions, 29 deletions
diff --git a/ssh.c b/ssh.c
index 449ec256e..d3a7ffc9b 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.300 2007/06/14 22:48:05 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.301 2007/08/07 07:32:53 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -857,6 +857,17 @@ ssh_init_forwarding(void)
857 "forwarding."); 857 "forwarding.");
858 } 858 }
859 } 859 }
860
861 /* Initiate tunnel forwarding. */
862 if (options.tun_open != SSH_TUNMODE_NO) {
863 if (client_request_tun_fwd(options.tun_open,
864 options.tun_local, options.tun_remote) == -1) {
865 if (options.exit_on_forward_failure)
866 fatal("Could not request tunnel forwarding.");
867 else
868 error("Could not request tunnel forwarding.");
869 }
870 }
860} 871}
861 872
862static void 873static void
@@ -1119,33 +1130,6 @@ ssh_session2_setup(int id, void *arg)
1119 packet_send(); 1130 packet_send();
1120 } 1131 }
1121 1132
1122 if (options.tun_open != SSH_TUNMODE_NO) {
1123 Channel *c;
1124 int fd;
1125
1126 debug("Requesting tun.");
1127 if ((fd = tun_open(options.tun_local,
1128 options.tun_open)) >= 0) {
1129 c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
1130 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
1131 0, "tun", 1);
1132 c->datagram = 1;
1133#if defined(SSH_TUN_FILTER)
1134 if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
1135 channel_register_filter(c->self, sys_tun_infilter,
1136 sys_tun_outfilter);
1137#endif
1138 packet_start(SSH2_MSG_CHANNEL_OPEN);
1139 packet_put_cstring("tun@openssh.com");
1140 packet_put_int(c->self);
1141 packet_put_int(c->local_window_max);
1142 packet_put_int(c->local_maxpacket);
1143 packet_put_int(options.tun_open);
1144 packet_put_int(options.tun_remote);
1145 packet_send();
1146 }
1147 }
1148
1149 client_session2_setup(id, tty_flag, subsystem_flag, getenv("TERM"), 1133 client_session2_setup(id, tty_flag, subsystem_flag, getenv("TERM"),
1150 NULL, fileno(stdin), &command, environ, &ssh_subsystem_reply); 1134 NULL, fileno(stdin), &command, environ, &ssh_subsystem_reply);
1151 1135
@@ -1205,7 +1189,6 @@ ssh_session2(void)
1205 1189
1206 /* XXX should be pre-session */ 1190 /* XXX should be pre-session */
1207 ssh_init_forwarding(); 1191 ssh_init_forwarding();
1208 ssh_control_listener();
1209 1192
1210 if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN)) 1193 if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN))
1211 id = ssh_session2_open(); 1194 id = ssh_session2_open();
@@ -1215,6 +1198,9 @@ ssh_session2(void)
1215 options.permit_local_command) 1198 options.permit_local_command)
1216 ssh_local_cmd(options.local_command); 1199 ssh_local_cmd(options.local_command);
1217 1200
1201 /* Start listening for multiplex clients */
1202 ssh_control_listener();
1203
1218 /* If requested, let ssh continue in the background. */ 1204 /* If requested, let ssh continue in the background. */
1219 if (fork_after_authentication_flag) 1205 if (fork_after_authentication_flag)
1220 if (daemon(1, 1) < 0) 1206 if (daemon(1, 1) < 0)