mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-04-24 12:21:59 +00:00
- djm@cvs.openbsd.org 2008/06/15 20:06:26
[channels.c channels.h session.c] don't call isatty() on a pty master, instead pass a flag down to channel_set_fds() indicating that te fds refer to a tty. Fixes a hang on exit on Solaris (bz#1463) in portable but is actually a generic bug; ok dtucker deraadt markus
This commit is contained in:
parent
307c1d10a7
commit
d310d51bad
@ -21,6 +21,12 @@
|
|||||||
- dtucker@cvs.openbsd.org 2008/06/15 16:58:40
|
- dtucker@cvs.openbsd.org 2008/06/15 16:58:40
|
||||||
[servconf.c sshd_config.5]
|
[servconf.c sshd_config.5]
|
||||||
Allow MaxAuthTries within a Match block. ok djm@
|
Allow MaxAuthTries within a Match block. ok djm@
|
||||||
|
- djm@cvs.openbsd.org 2008/06/15 20:06:26
|
||||||
|
[channels.c channels.h session.c]
|
||||||
|
don't call isatty() on a pty master, instead pass a flag down to
|
||||||
|
channel_set_fds() indicating that te fds refer to a tty. Fixes a
|
||||||
|
hang on exit on Solaris (bz#1463) in portable but is actually
|
||||||
|
a generic bug; ok dtucker deraadt markus
|
||||||
|
|
||||||
20080614
|
20080614
|
||||||
- (djm) [openbsd-compat/sigact.c] Avoid NULL derefs in ancient sigaction
|
- (djm) [openbsd-compat/sigact.c] Avoid NULL derefs in ancient sigaction
|
||||||
@ -4393,4 +4399,4 @@
|
|||||||
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
OpenServer 6 and add osr5bigcrypt support so when someone migrates
|
||||||
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
passwords between UnixWare and OpenServer they will still work. OK dtucker@
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.5018 2008/06/15 21:56:20 djm Exp $
|
$Id: ChangeLog,v 1.5019 2008/06/15 21:59:23 djm Exp $
|
||||||
|
23
channels.c
23
channels.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: channels.c,v 1.280 2008/06/12 15:19:17 djm Exp $ */
|
/* $OpenBSD: channels.c,v 1.281 2008/06/15 20:06:26 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
@ -221,7 +221,7 @@ channel_lookup(int id)
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
channel_register_fds(Channel *c, int rfd, int wfd, int efd,
|
channel_register_fds(Channel *c, int rfd, int wfd, int efd,
|
||||||
int extusage, int nonblock)
|
int extusage, int nonblock, int isatty)
|
||||||
{
|
{
|
||||||
/* Update the maximum file descriptor value. */
|
/* Update the maximum file descriptor value. */
|
||||||
channel_max_fd = MAX(channel_max_fd, rfd);
|
channel_max_fd = MAX(channel_max_fd, rfd);
|
||||||
@ -237,18 +237,9 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd,
|
|||||||
c->efd = efd;
|
c->efd = efd;
|
||||||
c->extended_usage = extusage;
|
c->extended_usage = extusage;
|
||||||
|
|
||||||
/* XXX ugly hack: nonblock is only set by the server */
|
if ((c->isatty = isatty) != 0)
|
||||||
if (nonblock && isatty(c->rfd)) {
|
|
||||||
debug2("channel %d: rfd %d isatty", c->self, c->rfd);
|
debug2("channel %d: rfd %d isatty", c->self, c->rfd);
|
||||||
c->isatty = 1;
|
c->wfd_isatty = isatty || isatty(c->wfd);
|
||||||
if (!isatty(c->wfd)) {
|
|
||||||
error("channel %d: wfd %d is not a tty?",
|
|
||||||
c->self, c->wfd);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
c->isatty = 0;
|
|
||||||
}
|
|
||||||
c->wfd_isatty = isatty(c->wfd);
|
|
||||||
|
|
||||||
/* enable nonblocking mode */
|
/* enable nonblocking mode */
|
||||||
if (nonblock) {
|
if (nonblock) {
|
||||||
@ -308,7 +299,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd,
|
|||||||
c->ostate = CHAN_OUTPUT_OPEN;
|
c->ostate = CHAN_OUTPUT_OPEN;
|
||||||
c->istate = CHAN_INPUT_OPEN;
|
c->istate = CHAN_INPUT_OPEN;
|
||||||
c->flags = 0;
|
c->flags = 0;
|
||||||
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
|
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock, 0);
|
||||||
c->self = found;
|
c->self = found;
|
||||||
c->type = type;
|
c->type = type;
|
||||||
c->ctype = ctype;
|
c->ctype = ctype;
|
||||||
@ -751,13 +742,13 @@ channel_register_filter(int id, channel_infilter_fn *ifn,
|
|||||||
|
|
||||||
void
|
void
|
||||||
channel_set_fds(int id, int rfd, int wfd, int efd,
|
channel_set_fds(int id, int rfd, int wfd, int efd,
|
||||||
int extusage, int nonblock, u_int window_max)
|
int extusage, int nonblock, int isatty, u_int window_max)
|
||||||
{
|
{
|
||||||
Channel *c = channel_lookup(id);
|
Channel *c = channel_lookup(id);
|
||||||
|
|
||||||
if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
|
if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
|
||||||
fatal("channel_activate for non-larval channel %d.", id);
|
fatal("channel_activate for non-larval channel %d.", id);
|
||||||
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
|
channel_register_fds(c, rfd, wfd, efd, extusage, nonblock, isatty);
|
||||||
c->type = SSH_CHANNEL_OPEN;
|
c->type = SSH_CHANNEL_OPEN;
|
||||||
c->local_window = c->local_window_max = window_max;
|
c->local_window = c->local_window_max = window_max;
|
||||||
packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
|
packet_start(SSH2_MSG_CHANNEL_WINDOW_ADJUST);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: channels.h,v 1.95 2008/06/12 15:19:17 djm Exp $ */
|
/* $OpenBSD: channels.h,v 1.96 2008/06/15 20:06:26 djm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
@ -188,7 +188,7 @@ struct Channel {
|
|||||||
Channel *channel_by_id(int);
|
Channel *channel_by_id(int);
|
||||||
Channel *channel_lookup(int);
|
Channel *channel_lookup(int);
|
||||||
Channel *channel_new(char *, int, int, int, int, u_int, u_int, int, char *, int);
|
Channel *channel_new(char *, int, int, int, int, u_int, u_int, int, char *, int);
|
||||||
void channel_set_fds(int, int, int, int, int, int, u_int);
|
void channel_set_fds(int, int, int, int, int, int, int, u_int);
|
||||||
void channel_free(Channel *);
|
void channel_free(Channel *);
|
||||||
void channel_free_all(void);
|
void channel_free_all(void);
|
||||||
void channel_stop_listening(void);
|
void channel_stop_listening(void);
|
||||||
|
15
session.c
15
session.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: session.c,v 1.239 2008/06/14 18:33:43 djm Exp $ */
|
/* $OpenBSD: session.c,v 1.240 2008/06/15 20:06:26 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
@ -98,7 +98,7 @@
|
|||||||
/* func */
|
/* func */
|
||||||
|
|
||||||
Session *session_new(void);
|
Session *session_new(void);
|
||||||
void session_set_fds(Session *, int, int, int);
|
void session_set_fds(Session *, int, int, int, int);
|
||||||
void session_pty_cleanup(Session *);
|
void session_pty_cleanup(Session *);
|
||||||
void session_proctitle(Session *);
|
void session_proctitle(Session *);
|
||||||
int session_setup_x11fwd(Session *);
|
int session_setup_x11fwd(Session *);
|
||||||
@ -591,7 +591,7 @@ do_exec_no_pty(Session *s, const char *command)
|
|||||||
close(perr[0]);
|
close(perr[0]);
|
||||||
perr[0] = -1;
|
perr[0] = -1;
|
||||||
}
|
}
|
||||||
session_set_fds(s, pin[1], pout[0], perr[0]);
|
session_set_fds(s, pin[1], pout[0], perr[0], 0);
|
||||||
} else {
|
} else {
|
||||||
/* Enter the interactive session. */
|
/* Enter the interactive session. */
|
||||||
server_loop(pid, pin[1], pout[0], perr[0]);
|
server_loop(pid, pin[1], pout[0], perr[0]);
|
||||||
@ -608,7 +608,7 @@ do_exec_no_pty(Session *s, const char *command)
|
|||||||
*/
|
*/
|
||||||
if (compat20) {
|
if (compat20) {
|
||||||
session_set_fds(s, inout[1], inout[1],
|
session_set_fds(s, inout[1], inout[1],
|
||||||
s->is_subsystem ? -1 : err[1]);
|
s->is_subsystem ? -1 : err[1], 0);
|
||||||
if (s->is_subsystem)
|
if (s->is_subsystem)
|
||||||
close(err[1]);
|
close(err[1]);
|
||||||
} else {
|
} else {
|
||||||
@ -733,7 +733,7 @@ do_exec_pty(Session *s, const char *command)
|
|||||||
s->ptymaster = ptymaster;
|
s->ptymaster = ptymaster;
|
||||||
packet_set_interactive(1);
|
packet_set_interactive(1);
|
||||||
if (compat20) {
|
if (compat20) {
|
||||||
session_set_fds(s, ptyfd, fdout, -1);
|
session_set_fds(s, ptyfd, fdout, -1, 1);
|
||||||
} else {
|
} else {
|
||||||
server_loop(pid, ptyfd, fdout, -1);
|
server_loop(pid, ptyfd, fdout, -1);
|
||||||
/* server_loop _has_ closed ptyfd and fdout. */
|
/* server_loop _has_ closed ptyfd and fdout. */
|
||||||
@ -2285,7 +2285,7 @@ session_input_channel_req(Channel *c, const char *rtype)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
session_set_fds(Session *s, int fdin, int fdout, int fderr)
|
session_set_fds(Session *s, int fdin, int fdout, int fderr, int isatty)
|
||||||
{
|
{
|
||||||
if (!compat20)
|
if (!compat20)
|
||||||
fatal("session_set_fds: called for proto != 2.0");
|
fatal("session_set_fds: called for proto != 2.0");
|
||||||
@ -2298,8 +2298,7 @@ session_set_fds(Session *s, int fdin, int fdout, int fderr)
|
|||||||
channel_set_fds(s->chanid,
|
channel_set_fds(s->chanid,
|
||||||
fdout, fdin, fderr,
|
fdout, fdin, fderr,
|
||||||
fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
|
fderr == -1 ? CHAN_EXTENDED_IGNORE : CHAN_EXTENDED_READ,
|
||||||
1,
|
1, isatty, CHAN_SES_WINDOW_DEFAULT);
|
||||||
CHAN_SES_WINDOW_DEFAULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user