version 1.57.2.1, 2000/06/12 02:37:32 |
version 1.57.2.2, 2000/09/01 18:23:18 |
|
|
*/ |
*/ |
|
|
#include "includes.h" |
#include "includes.h" |
RCSID("$Id$"); |
RCSID("$OpenBSD$"); |
|
|
#include "ssh.h" |
#include "ssh.h" |
#include "packet.h" |
#include "packet.h" |
#include "xmalloc.h" |
#include "xmalloc.h" |
#include "buffer.h" |
#include "buffer.h" |
#include "authfd.h" |
|
#include "uidswap.h" |
#include "uidswap.h" |
#include "readconf.h" |
#include "readconf.h" |
#include "servconf.h" |
#include "servconf.h" |
|
|
|
|
#include "ssh2.h" |
#include "ssh2.h" |
|
|
|
#include <openssl/rsa.h> |
|
#include <openssl/dsa.h> |
|
#include "key.h" |
|
#include "authfd.h" |
|
|
/* Maximum number of fake X11 displays to try. */ |
/* Maximum number of fake X11 displays to try. */ |
#define MAX_DISPLAYS 1000 |
#define MAX_DISPLAYS 1000 |
|
|
|
|
channel_lookup(int id) |
channel_lookup(int id) |
{ |
{ |
Channel *c; |
Channel *c; |
if (id < 0 && id > channels_alloc) { |
if (id < 0 || id > channels_alloc) { |
log("channel_lookup: %d: bad id", id); |
log("channel_lookup: %d: bad id", id); |
return NULL; |
return NULL; |
} |
} |
|
|
c->cb_arg = NULL; |
c->cb_arg = NULL; |
c->cb_event = 0; |
c->cb_event = 0; |
c->dettach_user = NULL; |
c->dettach_user = NULL; |
|
c->input_filter = NULL; |
debug("channel %d: new [%s]", found, remote_name); |
debug("channel %d: new [%s]", found, remote_name); |
return found; |
return found; |
} |
} |
|
|
} |
} |
return -1; |
return -1; |
} |
} |
buffer_append(&c->input, buf, len); |
if(c->input_filter != NULL) { |
|
if (c->input_filter(c, buf, len) == -1) { |
|
debug("filter stops channel %d", c->self); |
|
chan_read_failed(c); |
|
} |
|
} else { |
|
buffer_append(&c->input, buf, len); |
|
} |
} |
} |
return 1; |
return 1; |
} |
} |
|
|
packet_send(); |
packet_send(); |
buffer_consume(&c->input, len); |
buffer_consume(&c->input, len); |
c->remote_window -= len; |
c->remote_window -= len; |
debug("channel %d: send data len %d", c->self, len); |
|
} |
} |
} else if (c->istate == CHAN_INPUT_WAIT_DRAIN) { |
} else if (c->istate == CHAN_INPUT_WAIT_DRAIN) { |
if (compat13) |
if (compat13) |
|
|
return; |
return; |
} |
} |
c->dettach_user = NULL; |
c->dettach_user = NULL; |
|
} |
|
void |
|
channel_register_filter(int id, channel_filter_fn *fn) |
|
{ |
|
Channel *c = channel_lookup(id); |
|
if (c == NULL) { |
|
log("channel_register_filter: %d: bad id", id); |
|
return; |
|
} |
|
c->input_filter = fn; |
} |
} |
|
|
void |
void |