- markus@cvs.openbsd.org 2005/12/12 13:46:18
[channels.c channels.h session.c] make sure protocol messages for internal channels are ignored. allow adjust messages for non-open channels; with and ok djm@
This commit is contained in:
parent
7746c391b1
commit
d47c62a714
|
@ -51,6 +51,10 @@
|
||||||
- jmc@cvs.openbsd.org 2005/12/08 21:37:50
|
- jmc@cvs.openbsd.org 2005/12/08 21:37:50
|
||||||
[ssh_config.5]
|
[ssh_config.5]
|
||||||
new sentence, new line;
|
new sentence, new line;
|
||||||
|
- markus@cvs.openbsd.org 2005/12/12 13:46:18
|
||||||
|
[channels.c channels.h session.c]
|
||||||
|
make sure protocol messages for internal channels are ignored.
|
||||||
|
allow adjust messages for non-open channels; with and ok djm@
|
||||||
|
|
||||||
20051201
|
20051201
|
||||||
- (djm) [envpass.sh] Remove regress script that was accidentally committed
|
- (djm) [envpass.sh] Remove regress script that was accidentally committed
|
||||||
|
@ -3443,4 +3447,4 @@
|
||||||
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
- (djm) Trim deprecated options from INSTALL. Mention UsePAM
|
||||||
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
|
||||||
|
|
||||||
$Id: ChangeLog,v 1.4025 2005/12/13 08:33:37 djm Exp $
|
$Id: ChangeLog,v 1.4026 2005/12/13 08:33:57 djm Exp $
|
||||||
|
|
45
channels.c
45
channels.c
|
@ -39,7 +39,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: channels.c,v 1.228 2005/12/06 22:38:27 reyk Exp $");
|
RCSID("$OpenBSD: channels.c,v 1.229 2005/12/12 13:46:18 markus Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
|
@ -142,22 +142,50 @@ static void port_open_helper(Channel *c, char *rtype);
|
||||||
/* -- channel core */
|
/* -- channel core */
|
||||||
|
|
||||||
Channel *
|
Channel *
|
||||||
channel_lookup(int id)
|
channel_by_id(int id)
|
||||||
{
|
{
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
if (id < 0 || (u_int)id >= channels_alloc) {
|
if (id < 0 || (u_int)id >= channels_alloc) {
|
||||||
logit("channel_lookup: %d: bad id", id);
|
logit("channel_by_id: %d: bad id", id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
c = channels[id];
|
c = channels[id];
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
logit("channel_lookup: %d: bad id: channel free", id);
|
logit("channel_by_id: %d: bad id: channel free", id);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns the channel if it is allowed to receive protocol messages.
|
||||||
|
* Private channels, like listening sockets, may not receive messages.
|
||||||
|
*/
|
||||||
|
Channel *
|
||||||
|
channel_lookup(int id)
|
||||||
|
{
|
||||||
|
Channel *c;
|
||||||
|
|
||||||
|
if ((c = channel_by_id(id)) == NULL)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
|
switch(c->type) {
|
||||||
|
case SSH_CHANNEL_X11_OPEN:
|
||||||
|
case SSH_CHANNEL_LARVAL:
|
||||||
|
case SSH_CHANNEL_CONNECTING:
|
||||||
|
case SSH_CHANNEL_DYNAMIC:
|
||||||
|
case SSH_CHANNEL_OPENING:
|
||||||
|
case SSH_CHANNEL_OPEN:
|
||||||
|
case SSH_CHANNEL_INPUT_DRAINING:
|
||||||
|
case SSH_CHANNEL_OUTPUT_DRAINING:
|
||||||
|
return (c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
logit("Non-public channel %d, type %d.", id, c->type);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Register filedescriptors for a channel, used when allocating a channel or
|
* Register filedescriptors for a channel, used when allocating a channel or
|
||||||
* when the channel consumer/producer is ready, e.g. shell exec'd
|
* when the channel consumer/producer is ready, e.g. shell exec'd
|
||||||
|
@ -631,7 +659,7 @@ channel_register_confirm(int id, channel_callback_fn *fn, void *ctx)
|
||||||
void
|
void
|
||||||
channel_register_cleanup(int id, channel_callback_fn *fn, int do_close)
|
channel_register_cleanup(int id, channel_callback_fn *fn, int do_close)
|
||||||
{
|
{
|
||||||
Channel *c = channel_lookup(id);
|
Channel *c = channel_by_id(id);
|
||||||
|
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
logit("channel_register_cleanup: %d: bad id", id);
|
logit("channel_register_cleanup: %d: bad id", id);
|
||||||
|
@ -643,7 +671,7 @@ channel_register_cleanup(int id, channel_callback_fn *fn, int do_close)
|
||||||
void
|
void
|
||||||
channel_cancel_cleanup(int id)
|
channel_cancel_cleanup(int id)
|
||||||
{
|
{
|
||||||
Channel *c = channel_lookup(id);
|
Channel *c = channel_by_id(id);
|
||||||
|
|
||||||
if (c == NULL) {
|
if (c == NULL) {
|
||||||
logit("channel_cancel_cleanup: %d: bad id", id);
|
logit("channel_cancel_cleanup: %d: bad id", id);
|
||||||
|
@ -2183,9 +2211,8 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt)
|
||||||
id = packet_get_int();
|
id = packet_get_int();
|
||||||
c = channel_lookup(id);
|
c = channel_lookup(id);
|
||||||
|
|
||||||
if (c == NULL || c->type != SSH_CHANNEL_OPEN) {
|
if (c == NULL) {
|
||||||
logit("Received window adjust for "
|
logit("Received window adjust for non-open channel %d.", id);
|
||||||
"non-open channel %d.", id);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
adjust = packet_get_int();
|
adjust = packet_get_int();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $OpenBSD: channels.h,v 1.81 2005/12/06 22:38:27 reyk Exp $ */
|
/* $OpenBSD: channels.h,v 1.82 2005/12/12 13:46:18 markus Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
* Author: Tatu Ylonen <ylo@cs.hut.fi>
|
||||||
|
@ -157,6 +157,7 @@ struct Channel {
|
||||||
|
|
||||||
/* channel management */
|
/* channel management */
|
||||||
|
|
||||||
|
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, u_int);
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
RCSID("$OpenBSD: session.c,v 1.188 2005/10/30 08:52:17 djm Exp $");
|
RCSID("$OpenBSD: session.c,v 1.189 2005/12/12 13:46:18 markus Exp $");
|
||||||
|
|
||||||
#include "ssh.h"
|
#include "ssh.h"
|
||||||
#include "ssh1.h"
|
#include "ssh1.h"
|
||||||
|
@ -2101,7 +2101,7 @@ session_close_x11(int id)
|
||||||
{
|
{
|
||||||
Channel *c;
|
Channel *c;
|
||||||
|
|
||||||
if ((c = channel_lookup(id)) == NULL) {
|
if ((c = channel_by_id(id)) == NULL) {
|
||||||
debug("session_close_x11: x11 channel %d missing", id);
|
debug("session_close_x11: x11 channel %d missing", id);
|
||||||
} else {
|
} else {
|
||||||
/* Detach X11 listener */
|
/* Detach X11 listener */
|
||||||
|
|
Loading…
Reference in New Issue