summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-09-20 23:13:49 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-09-20 23:13:49 +0000
commitf558cf658023ed272a75c9b942bdd0499805413b (patch)
tree96d081d6bf029b89c01d839db513582378231ec5 /ssh.c
parent1bc3bdb1c2d378687ab356b9f860262e8955e058 (diff)
- markus@cvs.openbsd.org 2001/09/20 13:50:40
[compat.c compat.h ssh.c] bug compat: request a dummy channel for -N (no shell) sessions + cleanup; vinschen@redhat.com
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/ssh.c b/ssh.c
index 9ccd9d8f1..f0cbd799c 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.142 2001/09/03 20:58:33 stevesk Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.143 2001/09/20 13:50:40 markus Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -1032,14 +1032,15 @@ client_subsystem_reply(int type, int plen, void *ctxt)
1032 len, buffer_ptr(&command), id); 1032 len, buffer_ptr(&command), id);
1033} 1033}
1034 1034
1035/* request pty/x11/agent/tcpfwd/shell for channel */
1035static void 1036static void
1036ssh_session2_callback(int id, void *arg) 1037ssh_session2_setup(int id, void *arg)
1037{ 1038{
1038 int len; 1039 int len;
1039 int interactive = 0; 1040 int interactive = 0;
1040 struct termios tio; 1041 struct termios tio;
1041 1042
1042 debug("client_init id %d arg %ld", id, (long)arg); 1043 debug("ssh_session2_setup: id %d", id);
1043 1044
1044 if (tty_flag) { 1045 if (tty_flag) {
1045 struct winsize ws; 1046 struct winsize ws;
@@ -1108,8 +1109,9 @@ ssh_session2_callback(int id, void *arg)
1108 packet_set_interactive(interactive); 1109 packet_set_interactive(interactive);
1109} 1110}
1110 1111
1112/* open new channel for a session */
1111static int 1113static int
1112ssh_session2_command(void) 1114ssh_session2_open(void)
1113{ 1115{
1114 Channel *c; 1116 Channel *c;
1115 int window, packetmax, in, out, err; 1117 int window, packetmax, in, out, err;
@@ -1144,13 +1146,15 @@ ssh_session2_command(void)
1144 window, packetmax, CHAN_EXTENDED_WRITE, 1146 window, packetmax, CHAN_EXTENDED_WRITE,
1145 xstrdup("client-session"), /*nonblock*/0); 1147 xstrdup("client-session"), /*nonblock*/0);
1146 if (c == NULL) 1148 if (c == NULL)
1147 fatal("ssh_session2_command: channel_new failed"); 1149 fatal("ssh_session2_open: channel_new failed");
1148 1150
1149 debug3("ssh_session2_command: channel_new: %d", c->self); 1151 debug3("ssh_session2_open: channel_new: %d", c->self);
1150 1152
1151 channel_send_open(c->self); 1153 channel_send_open(c->self);
1152 channel_register_callback(c->self, SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, 1154 if (!no_shell_flag)
1153 ssh_session2_callback, (void *)0); 1155 channel_register_callback(c->self,
1156 SSH2_MSG_CHANNEL_OPEN_CONFIRMATION,
1157 ssh_session2_setup, (void *)0);
1154 1158
1155 return c->self; 1159 return c->self;
1156} 1160}
@@ -1158,12 +1162,13 @@ ssh_session2_command(void)
1158static int 1162static int
1159ssh_session2(void) 1163ssh_session2(void)
1160{ 1164{
1161 int id; 1165 int id = -1;
1162 1166
1163 /* XXX should be pre-session */ 1167 /* XXX should be pre-session */
1164 ssh_init_forwarding(); 1168 ssh_init_forwarding();
1165 1169
1166 id = no_shell_flag ? -1 : ssh_session2_command(); 1170 if (!no_shell_flag || (datafellows & SSH_BUG_DUMMYCHAN))
1171 id = ssh_session2_open();
1167 1172
1168 /* If requested, let ssh continue in the background. */ 1173 /* If requested, let ssh continue in the background. */
1169 if (fork_after_authentication_flag) 1174 if (fork_after_authentication_flag)