View | Details | Raw Unified | Return to bug 1463
Collapse All | Expand All

(-)../openssh-5.0p1.orig/channels.c (-6 / +6 lines)
Lines 216-222 Link Here
216
 */
216
 */
217
static void
217
static void
218
channel_register_fds(Channel *c, int rfd, int wfd, int efd,
218
channel_register_fds(Channel *c, int rfd, int wfd, int efd,
219
    int extusage, int nonblock)
219
    int extusage, int nonblock, int forcetty)
220
{
220
{
221
	/* Update the maximum file descriptor value. */
221
	/* Update the maximum file descriptor value. */
222
	channel_max_fd = MAX(channel_max_fd, rfd);
222
	channel_max_fd = MAX(channel_max_fd, rfd);
Lines 233-242 Link Here
233
	c->extended_usage = extusage;
233
	c->extended_usage = extusage;
234
234
235
	/* XXX ugly hack: nonblock is only set by the server */
235
	/* XXX ugly hack: nonblock is only set by the server */
236
	if (nonblock && isatty(c->rfd)) {
236
	if (forcetty || (nonblock && isatty(c->rfd))) {
237
		debug2("channel %d: rfd %d isatty", c->self, c->rfd);
237
		debug2("channel %d: rfd %d isatty", c->self, c->rfd);
238
		c->isatty = 1;
238
		c->isatty = 1;
239
		if (!isatty(c->wfd)) {
239
		if (!forcetty && !isatty(c->wfd)) {
240
			error("channel %d: wfd %d is not a tty?",
240
			error("channel %d: wfd %d is not a tty?",
241
			    c->self, c->wfd);
241
			    c->self, c->wfd);
242
		}
242
		}
Lines 303-309 Link Here
303
	c->ostate = CHAN_OUTPUT_OPEN;
303
	c->ostate = CHAN_OUTPUT_OPEN;
304
	c->istate = CHAN_INPUT_OPEN;
304
	c->istate = CHAN_INPUT_OPEN;
305
	c->flags = 0;
305
	c->flags = 0;
306
	channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
306
	channel_register_fds(c, rfd, wfd, efd, extusage, nonblock, 0);
307
	c->self = found;
307
	c->self = found;
308
	c->type = type;
308
	c->type = type;
309
	c->ctype = ctype;
309
	c->ctype = ctype;
Lines 714-726 Link Here
714
714
715
void
715
void
716
channel_set_fds(int id, int rfd, int wfd, int efd,
716
channel_set_fds(int id, int rfd, int wfd, int efd,
717
    int extusage, int nonblock, u_int window_max)
717
    int extusage, int nonblock, int forcetty, u_int window_max)
718
{
718
{
719
	Channel *c = channel_lookup(id);
719
	Channel *c = channel_lookup(id);
720
720
721
	if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
721
	if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
722
		fatal("channel_activate for non-larval channel %d.", id);
722
		fatal("channel_activate for non-larval channel %d.", id);
723
	channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
723
	channel_register_fds(c, rfd, wfd, efd, extusage, nonblock, forcetty);
724
	c->type = SSH_CHANNEL_OPEN;
724
	c->type = SSH_CHANNEL_OPEN;
725
	c->local_window = c->local_window_max = window_max;
725
	c->local_window = c->local_window_max = window_max;
726
	packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
726
	packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
(-)../openssh-5.0p1.orig/channels.h (-1 / +1 lines)
Lines 162-168 Link Here
162
Channel	*channel_by_id(int);
162
Channel	*channel_by_id(int);
163
Channel	*channel_lookup(int);
163
Channel	*channel_lookup(int);
164
Channel *channel_new(char *, int, int, int, int, u_int, u_int, int, char *, int);
164
Channel *channel_new(char *, int, int, int, int, u_int, u_int, int, char *, int);
165
void	 channel_set_fds(int, int, int, int, int, int, u_int);
165
void	 channel_set_fds(int, int, int, int, int, int, int, u_int);
166
void	 channel_free(Channel *);
166
void	 channel_free(Channel *);
167
void	 channel_free_all(void);
167
void	 channel_free_all(void);
168
void	 channel_stop_listening(void);
168
void	 channel_stop_listening(void);
(-)../openssh-5.0p1.orig/session.c (-6 / +7 lines)
Lines 97-103 Link Here
97
/* func */
97
/* func */
98
98
99
Session *session_new(void);
99
Session *session_new(void);
100
void	session_set_fds(Session *, int, int, int);
100
void	session_set_fds(Session *, int, int, int, int);
101
void	session_pty_cleanup(Session *);
101
void	session_pty_cleanup(Session *);
102
void	session_proctitle(Session *);
102
void	session_proctitle(Session *);
103
int	session_setup_x11fwd(Session *);
103
int	session_setup_x11fwd(Session *);
Lines 510-516 Link Here
510
			close(perr[0]);
510
			close(perr[0]);
511
			perr[0] = -1;
511
			perr[0] = -1;
512
		}
512
		}
513
		session_set_fds(s, pin[1], pout[0], perr[0]);
513
		session_set_fds(s, pin[1], pout[0], perr[0], 0);
514
	} else {
514
	} else {
515
		/* Enter the interactive session. */
515
		/* Enter the interactive session. */
516
		server_loop(pid, pin[1], pout[0], perr[0]);
516
		server_loop(pid, pin[1], pout[0], perr[0]);
Lines 533-539 Link Here
533
	 * handle the case that fdin and fdout are the same.
533
	 * handle the case that fdin and fdout are the same.
534
	 */
534
	 */
535
	if (compat20) {
535
	if (compat20) {
536
		session_set_fds(s, inout[1], inout[1], s->is_subsystem ? -1 : err[1]);
536
		session_set_fds(s, inout[1], inout[1],
537
		    s->is_subsystem ? -1 : err[1], 0);
537
	} else {
538
	} else {
538
		server_loop(pid, inout[1], inout[1], err[1]);
539
		server_loop(pid, inout[1], inout[1], err[1]);
539
		/* server_loop has closed inout[1] and err[1]. */
540
		/* server_loop has closed inout[1] and err[1]. */
Lines 631-637 Link Here
631
	/* Enter interactive session. */
632
	/* Enter interactive session. */
632
	packet_set_interactive(1);
633
	packet_set_interactive(1);
633
	if (compat20) {
634
	if (compat20) {
634
		session_set_fds(s, ptyfd, fdout, -1);
635
		session_set_fds(s, ptyfd, fdout, -1, 1);
635
	} else {
636
	} else {
636
		server_loop(pid, ptyfd, fdout, -1);
637
		server_loop(pid, ptyfd, fdout, -1);
637
		/* server_loop _has_ closed ptyfd and fdout. */
638
		/* server_loop _has_ closed ptyfd and fdout. */
Lines 2137-2143 Link Here
2137
}
2138
}
2138
2139
2139
void
2140
void
2140
session_set_fds(Session *s, int fdin, int fdout, int fderr)
2141
session_set_fds(Session *s, int fdin, int fdout, int fderr, int forcetty)
2141
{
2142
{
2142
	if (!compat20)
2143
	if (!compat20)
2143
		fatal("session_set_fds: called for proto != 2.0");
2144
		fatal("session_set_fds: called for proto != 2.0");
Lines 2150-2156 Link Here
2150
	channel_set_fds(s->chanid,
2151
	channel_set_fds(s->chanid,
2151
	    fdout, fdin, fderr,
2152
	    fdout, fdin, fderr,
2152
	    fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
2153
	    fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
2153
	    1,
2154
	    1, forcetty,
2154
	    CHAN_SES_WINDOW_DEFAULT);
2155
	    CHAN_SES_WINDOW_DEFAULT);
2155
}
2156
}
2156
2157

Return to bug 1463