[BACK]Return to channels.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/channels.c between version 1.236 and 1.237

version 1.236, 2006/03/19 18:51:18 version 1.237, 2006/03/19 18:52:11
Line 173 
Line 173 
         if ((c = channel_by_id(id)) == NULL)          if ((c = channel_by_id(id)) == NULL)
                 return (NULL);                  return (NULL);
   
         switch(c->type) {          switch (c->type) {
         case SSH_CHANNEL_X11_OPEN:          case SSH_CHANNEL_X11_OPEN:
         case SSH_CHANNEL_LARVAL:          case SSH_CHANNEL_LARVAL:
         case SSH_CHANNEL_CONNECTING:          case SSH_CHANNEL_CONNECTING:
Line 183 
Line 183 
         case SSH_CHANNEL_INPUT_DRAINING:          case SSH_CHANNEL_INPUT_DRAINING:
         case SSH_CHANNEL_OUTPUT_DRAINING:          case SSH_CHANNEL_OUTPUT_DRAINING:
                 return (c);                  return (c);
                 break;  
         }          }
         logit("Non-public channel %d, type %d.", id, c->type);          logit("Non-public channel %d, type %d.", id, c->type);
         return (NULL);          return (NULL);
Line 722 
Line 721 
  * 'channel_post*': perform any appropriate operations for channels which   * 'channel_post*': perform any appropriate operations for channels which
  * have events pending.   * have events pending.
  */   */
 typedef void chan_fn(Channel *c, fd_set * readset, fd_set * writeset);  typedef void chan_fn(Channel *c, fd_set *readset, fd_set *writeset);
 chan_fn *channel_pre[SSH_CHANNEL_MAX_TYPE];  chan_fn *channel_pre[SSH_CHANNEL_MAX_TYPE];
 chan_fn *channel_post[SSH_CHANNEL_MAX_TYPE];  chan_fn *channel_post[SSH_CHANNEL_MAX_TYPE];
   
 static void  static void
 channel_pre_listener(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_listener(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         FD_SET(c->sock, readset);          FD_SET(c->sock, readset);
 }  }
   
 static void  static void
 channel_pre_connecting(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_connecting(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         debug3("channel %d: waiting for connection", c->self);          debug3("channel %d: waiting for connection", c->self);
         FD_SET(c->sock, writeset);          FD_SET(c->sock, writeset);
 }  }
   
 static void  static void
 channel_pre_open_13(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_open_13(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         if (buffer_len(&c->input) < packet_get_maxsize())          if (buffer_len(&c->input) < packet_get_maxsize())
                 FD_SET(c->sock, readset);                  FD_SET(c->sock, readset);
Line 749 
Line 748 
 }  }
   
 static void  static void
 channel_pre_open(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_open(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         u_int limit = compat20 ? c->remote_window : packet_get_maxsize();          u_int limit = compat20 ? c->remote_window : packet_get_maxsize();
   
Line 789 
Line 788 
 }  }
   
 static void  static void
 channel_pre_input_draining(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_input_draining(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         if (buffer_len(&c->input) == 0) {          if (buffer_len(&c->input) == 0) {
                 packet_start(SSH_MSG_CHANNEL_CLOSE);                  packet_start(SSH_MSG_CHANNEL_CLOSE);
Line 801 
Line 800 
 }  }
   
 static void  static void
 channel_pre_output_draining(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_output_draining(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         if (buffer_len(&c->output) == 0)          if (buffer_len(&c->output) == 0)
                 chan_mark_dead(c);                  chan_mark_dead(c);
Line 877 
Line 876 
 }  }
   
 static void  static void
 channel_pre_x11_open_13(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_x11_open_13(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         int ret = x11_open_helper(&c->output);          int ret = x11_open_helper(&c->output);
   
Line 903 
Line 902 
 }  }
   
 static void  static void
 channel_pre_x11_open(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_x11_open(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         int ret = x11_open_helper(&c->output);          int ret = x11_open_helper(&c->output);
   
Line 930 
Line 929 
   
 /* try to decode a socks4 header */  /* try to decode a socks4 header */
 static int  static int
 channel_decode_socks4(Channel *c, fd_set * readset, fd_set * writeset)  channel_decode_socks4(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         char *p, *host;          char *p, *host;
         u_int len, have, i, found;          u_int len, have, i, found;
Line 1008 
Line 1007 
 #define SSH_SOCKS5_SUCCESS      0x00  #define SSH_SOCKS5_SUCCESS      0x00
   
 static int  static int
 channel_decode_socks5(Channel *c, fd_set * readset, fd_set * writeset)  channel_decode_socks5(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         struct {          struct {
                 u_int8_t version;                  u_int8_t version;
Line 1111 
Line 1110 
   
 /* dynamic port forwarding */  /* dynamic port forwarding */
 static void  static void
 channel_pre_dynamic(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_dynamic(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         u_char *p;          u_char *p;
         u_int have;          u_int have;
Line 1155 
Line 1154 
   
 /* This is our fake X11 server socket. */  /* This is our fake X11 server socket. */
 static void  static void
 channel_post_x11_listener(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_x11_listener(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         Channel *nc;          Channel *nc;
         struct sockaddr addr;          struct sockaddr addr;
Line 1280 
Line 1279 
  * This socket is listening for connections to a forwarded TCP/IP port.   * This socket is listening for connections to a forwarded TCP/IP port.
  */   */
 static void  static void
 channel_post_port_listener(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_port_listener(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         Channel *nc;          Channel *nc;
         struct sockaddr addr;          struct sockaddr addr;
Line 1337 
Line 1336 
  * clients.   * clients.
  */   */
 static void  static void
 channel_post_auth_listener(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_auth_listener(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         Channel *nc;          Channel *nc;
         int newsock;          int newsock;
Line 1370 
Line 1369 
 }  }
   
 static void  static void
 channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_connecting(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         int err = 0;          int err = 0;
         socklen_t sz = sizeof(err);          socklen_t sz = sizeof(err);
Line 1416 
Line 1415 
 }  }
   
 static int  static int
 channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)  channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         char buf[CHAN_RBUF];          char buf[CHAN_RBUF];
         int len;          int len;
Line 1456 
Line 1455 
         return 1;          return 1;
 }  }
 static int  static int
 channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)  channel_handle_wfd(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         struct termios tio;          struct termios tio;
         u_char *data = NULL, *buf;          u_char *data = NULL, *buf;
Line 1538 
Line 1537 
         return 1;          return 1;
 }  }
 static int  static int
 channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset)  channel_handle_efd(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         char buf[CHAN_RBUF];          char buf[CHAN_RBUF];
         int len;          int len;
Line 1581 
Line 1580 
         return 1;          return 1;
 }  }
 static int  static int
 channel_handle_ctl(Channel *c, fd_set * readset, fd_set * writeset)  channel_handle_ctl(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         char buf[16];          char buf[16];
         int len;          int len;
Line 1628 
Line 1627 
 }  }
   
 static void  static void
 channel_post_open(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_open(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         if (c->delayed)          if (c->delayed)
                 return;                  return;
Line 1642 
Line 1641 
 }  }
   
 static void  static void
 channel_post_output_drain_13(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_output_drain_13(Channel *c, fd_set *readset, fd_set *writeset)
 {  {
         int len;          int len;
   
Line 1759 
Line 1758 
 }  }
   
 static void  static void
 channel_handler(chan_fn *ftab[], fd_set * readset, fd_set * writeset)  channel_handler(chan_fn *ftab[], fd_set *readset, fd_set *writeset)
 {  {
         static int did_init = 0;          static int did_init = 0;
         u_int i;          u_int i;
Line 1811 
Line 1810 
  * events pending.   * events pending.
  */   */
 void  void
 channel_after_select(fd_set * readset, fd_set * writeset)  channel_after_select(fd_set *readset, fd_set *writeset)
 {  {
         channel_handler(channel_post, readset, writeset);          channel_handler(channel_post, readset, writeset);
 }  }

Legend:
Removed from v.1.236  
changed lines
  Added in v.1.237