[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.126 and 1.127

version 1.126, 2001/06/20 13:56:39 version 1.127, 2001/06/23 15:12:17
Line 133 
Line 133 
 static char *auth_sock_name = NULL;  static char *auth_sock_name = NULL;
 static char *auth_sock_dir = NULL;  static char *auth_sock_dir = NULL;
   
   
 /* AF_UNSPEC or AF_INET or AF_INET6 */  /* AF_UNSPEC or AF_INET or AF_INET6 */
 extern int IPv4or6;  extern int IPv4or6;
   
 /* helper */  /* helper */
 void    port_open_helper(Channel *c, char *rtype);  static void port_open_helper(Channel *c, char *rtype);
   
 /* -- channel core */  /* -- channel core */
   
Line 164 
Line 163 
  * when the channel consumer/producer is ready, e.g. shell exec'd   * when the channel consumer/producer is ready, e.g. shell exec'd
  */   */
   
 void  static void
 channel_register_fds(Channel *c, int rfd, int wfd, int efd,  channel_register_fds(Channel *c, int rfd, int wfd, int efd,
     int extusage, int nonblock)      int extusage, int nonblock)
 {  {
Line 270 
Line 269 
   
 /* Close all channel fd/socket. */  /* Close all channel fd/socket. */
   
 void  static void
 channel_close_fds(Channel *c)  channel_close_fds(Channel *c)
 {  {
         debug3("channel_close_fds: channel %d: r %d w %d e %d",          debug3("channel_close_fds: channel %d: r %d w %d e %d",
Line 633 
Line 632 
 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];
   
 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);
 }  }
   
 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);
 }  }
   
 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())
Line 655 
Line 654 
                 FD_SET(c->sock, writeset);                  FD_SET(c->sock, writeset);
 }  }
   
 void  static void
 channel_pre_open_15(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_open_15(Channel *c, fd_set * readset, fd_set * writeset)
 {  {
         /* test whether sockets are 'alive' for read/write */          /* test whether sockets are 'alive' for read/write */
Line 672 
Line 671 
         }          }
 }  }
   
 void  static void
 channel_pre_open_20(Channel *c, fd_set * readset, fd_set * writeset)  channel_pre_open_20(Channel *c, fd_set * readset, fd_set * writeset)
 {  {
         if (c->istate == CHAN_INPUT_OPEN &&          if (c->istate == CHAN_INPUT_OPEN &&
Line 698 
Line 697 
         }          }
 }  }
   
 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) {
Line 710 
Line 709 
         }          }
 }  }
   
 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)
Line 728 
Line 727 
  * XXX All this happens at the client side.   * XXX All this happens at the client side.
  * Returns: 0 = need more data, -1 = wrong cookie, 1 = ok   * Returns: 0 = need more data, -1 = wrong cookie, 1 = ok
  */   */
 int  static int
 x11_open_helper(Buffer *b)  x11_open_helper(Buffer *b)
 {  {
         u_char *ucp;          u_char *ucp;
Line 786 
Line 785 
         return 1;          return 1;
 }  }
   
 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 811 
Line 810 
         }          }
 }  }
   
 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 830 
Line 829 
 }  }
   
 /* try to decode a socks4 header */  /* try to decode a socks4 header */
 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)
 {  {
         u_char *p, *host;          u_char *p, *host;
Line 900 
Line 899 
 }  }
   
 /* dynamic port forwarding */  /* dynamic port forwarding */
 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;
Line 940 
Line 939 
 }  }
   
 /* This is our fake X11 server socket. */  /* This is our fake X11 server socket. */
 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;
Line 998 
Line 997 
         }          }
 }  }
   
 void  static void
 port_open_helper(Channel *c, char *rtype)  port_open_helper(Channel *c, char *rtype)
 {  {
         int direct;          int direct;
Line 1052 
Line 1051 
 /*  /*
  * This socket is listening for connections to a forwarded TCP/IP port.   * This socket is listening for connections to a forwarded TCP/IP port.
  */   */
 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;
Line 1100 
Line 1099 
  * This is the authentication agent socket listening for connections from   * This is the authentication agent socket listening for connections from
  * clients.   * clients.
  */   */
 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;
Line 1140 
Line 1139 
         }          }
 }  }
   
 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;
Line 1187 
Line 1186 
         }          }
 }  }
   
 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[16*1024];          char buf[16*1024];
Line 1225 
Line 1224 
         }          }
         return 1;          return 1;
 }  }
 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;
Line 1273 
Line 1272 
         }          }
         return 1;          return 1;
 }  }
 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[16*1024];          char buf[16*1024];
Line 1318 
Line 1317 
         }          }
         return 1;          return 1;
 }  }
 int  static int
 channel_check_window(Channel *c)  channel_check_window(Channel *c)
 {  {
         if (c->type == SSH_CHANNEL_OPEN &&          if (c->type == SSH_CHANNEL_OPEN &&
Line 1338 
Line 1337 
         return 1;          return 1;
 }  }
   
 void  static void
 channel_post_open_1(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_open_1(Channel *c, fd_set * readset, fd_set * writeset)
 {  {
         channel_handle_rfd(c, readset, writeset);          channel_handle_rfd(c, readset, writeset);
         channel_handle_wfd(c, readset, writeset);          channel_handle_wfd(c, readset, writeset);
 }  }
   
 void  static void
 channel_post_open_2(Channel *c, fd_set * readset, fd_set * writeset)  channel_post_open_2(Channel *c, fd_set * readset, fd_set * writeset)
 {  {
         channel_handle_rfd(c, readset, writeset);          channel_handle_rfd(c, readset, writeset);
Line 1355 
Line 1354 
         channel_check_window(c);          channel_check_window(c);
 }  }
   
 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 1370 
Line 1369 
         }          }
 }  }
   
 void  static void
 channel_handler_init_20(void)  channel_handler_init_20(void)
 {  {
         channel_pre[SSH_CHANNEL_OPEN] =                 &channel_pre_open_20;          channel_pre[SSH_CHANNEL_OPEN] =                 &channel_pre_open_20;
Line 1391 
Line 1390 
         channel_post[SSH_CHANNEL_DYNAMIC] =             &channel_post_open_2;          channel_post[SSH_CHANNEL_DYNAMIC] =             &channel_post_open_2;
 }  }
   
 void  static void
 channel_handler_init_13(void)  channel_handler_init_13(void)
 {  {
         channel_pre[SSH_CHANNEL_OPEN] =                 &channel_pre_open_13;          channel_pre[SSH_CHANNEL_OPEN] =                 &channel_pre_open_13;
Line 1413 
Line 1412 
         channel_post[SSH_CHANNEL_DYNAMIC] =             &channel_post_open_1;          channel_post[SSH_CHANNEL_DYNAMIC] =             &channel_post_open_1;
 }  }
   
 void  static void
 channel_handler_init_15(void)  channel_handler_init_15(void)
 {  {
         channel_pre[SSH_CHANNEL_OPEN] =                 &channel_pre_open_15;          channel_pre[SSH_CHANNEL_OPEN] =                 &channel_pre_open_15;
Line 1432 
Line 1431 
         channel_post[SSH_CHANNEL_DYNAMIC] =             &channel_post_open_1;          channel_post[SSH_CHANNEL_DYNAMIC] =             &channel_post_open_1;
 }  }
   
 void  static void
 channel_handler_init(void)  channel_handler_init(void)
 {  {
         int i;          int i;
Line 1448 
Line 1447 
                 channel_handler_init_15();                  channel_handler_init_15();
 }  }
   
 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;
Line 1828 
Line 1827 
         }          }
 }  }
   
 char *  static char *
 reason2txt(int reason)  reason2txt(int reason)
 {  {
         switch(reason) {          switch(reason) {
Line 2214 
Line 2213 
   
   
 /* return socket to remote host, port */  /* return socket to remote host, port */
 int  static int
 connect_to(const char *host, u_short port)  connect_to(const char *host, u_short port)
 {  {
         struct addrinfo hints, *ai, *aitop;          struct addrinfo hints, *ai, *aitop;
Line 2398 
Line 2397 
 #define X_UNIX_PATH "/tmp/.X11-unix/X"  #define X_UNIX_PATH "/tmp/.X11-unix/X"
 #endif  #endif
   
 static  static int
 int  
 connect_local_xsocket(u_int dnr)  connect_local_xsocket(u_int dnr)
 {  {
         static const char *const x_sockets[] = {          static const char *const x_sockets[] = {

Legend:
Removed from v.1.126  
changed lines
  Added in v.1.127