diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2000-08-19 18:48:12 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2000-08-19 18:48:12 +0000 |
commit | 98608d3cbacf5afa9ff8e2432690d654b80b80db (patch) | |
tree | 68b4bc2fcfc08f52e20392ff4962e107871a8d93 /usr.bin/ssh/channels.c | |
parent | 54ce3936b30d6e17aa54a6e739142ae3fc0e585c (diff) |
support for ~. in ssh2
Diffstat (limited to 'usr.bin/ssh/channels.c')
-rw-r--r-- | usr.bin/ssh/channels.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.bin/ssh/channels.c b/usr.bin/ssh/channels.c index 37b40347fb9..3ecceb639b4 100644 --- a/usr.bin/ssh/channels.c +++ b/usr.bin/ssh/channels.c @@ -17,7 +17,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: channels.c,v 1.64 2000/07/16 08:27:21 markus Exp $"); +RCSID("$OpenBSD: channels.c,v 1.65 2000/08/19 18:48:10 markus Exp $"); #include "ssh.h" #include "packet.h" @@ -244,6 +244,7 @@ channel_new(char *ctype, int type, int rfd, int wfd, int efd, c->cb_arg = NULL; c->cb_event = 0; c->dettach_user = NULL; + c->input_filter = NULL; debug("channel %d: new [%s]", found, remote_name); return found; } @@ -665,7 +666,14 @@ channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) } return -1; } - buffer_append(&c->input, buf, len); + if(c->input_filter != NULL) { + if (c->input_filter(&c->input, buf, len) == -1) { + debug("filter stops channel %d", c->self); + chan_read_failed(c); + } + } else { + buffer_append(&c->input, buf, len); + } } return 1; } @@ -2253,6 +2261,16 @@ channel_cancel_cleanup(int id) } 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 channel_set_fds(int id, int rfd, int wfd, int efd, int extusage) |