]> andersk Git - openssh.git/blobdiff - channels.c
- (djm) Pick up LOGIN_PROGRAM from environment or PATH if not set by headers
[openssh.git] / channels.c
index ea395293a6b68f83ee23a9d7f83919c77d062515..c77f6b96a4a96534251074e6c8aec25ef9cf6654 100644 (file)
@@ -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.66 2000/08/19 21:55:51 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, buf, len) == -1) {
+                               debug("filter stops channel %d", c->self);
+                               chan_read_failed(c);
+                       }
+               } else {
+                       buffer_append(&c->input, buf, len);
+               }
        }
        return 1;
 }
@@ -2309,6 +2317,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)
This page took 0.034485 seconds and 4 git commands to generate.