[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.70 and 1.71

version 1.70, 2000/09/28 18:03:18 version 1.71, 2000/10/27 07:32:17
Line 174 
Line 174 
  */   */
   
 void  void
 channel_register_fds(Channel *c, int rfd, int wfd, int efd, int extusage)  channel_register_fds(Channel *c, int rfd, int wfd, int efd,
       int extusage, int nonblock)
 {  {
         /* Update the maximum file descriptor value. */          /* Update the maximum file descriptor value. */
         if (rfd > channel_max_fd_value)          if (rfd > channel_max_fd_value)
Line 190 
Line 191 
         c->sock = (rfd == wfd) ? rfd : -1;          c->sock = (rfd == wfd) ? rfd : -1;
         c->efd = efd;          c->efd = efd;
         c->extended_usage = extusage;          c->extended_usage = extusage;
         if (rfd != -1)  
                 set_nonblock(rfd);          /* enable nonblocking mode */
         if (wfd != -1)          if (nonblock) {
                 set_nonblock(wfd);                  if (rfd != -1)
         if (efd != -1)                          set_nonblock(rfd);
                 set_nonblock(efd);                  if (wfd != -1)
                           set_nonblock(wfd);
                   if (efd != -1)
                           set_nonblock(efd);
           }
 }  }
   
 /*  /*
Line 205 
Line 210 
   
 int  int
 channel_new(char *ctype, int type, int rfd, int wfd, int efd,  channel_new(char *ctype, int type, int rfd, int wfd, int efd,
     int window, int maxpack, int extusage, char *remote_name)      int window, int maxpack, int extusage, char *remote_name, int nonblock)
 {  {
         int i, found;          int i, found;
         Channel *c;          Channel *c;
Line 245 
Line 250 
         buffer_init(&c->output);          buffer_init(&c->output);
         buffer_init(&c->extended);          buffer_init(&c->extended);
         chan_init_iostates(c);          chan_init_iostates(c);
         channel_register_fds(c, rfd, wfd, efd, extusage);          channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
         c->self = found;          c->self = found;
         c->type = type;          c->type = type;
         c->ctype = ctype;          c->ctype = ctype;
Line 269 
Line 274 
 int  int
 channel_allocate(int type, int sock, char *remote_name)  channel_allocate(int type, int sock, char *remote_name)
 {  {
         return channel_new("", type, sock, sock, -1, 0, 0, 0, remote_name);          return channel_new("", type, sock, sock, -1, 0, 0, 0, remote_name, 1);
 }  }
   
   
Line 548 
Line 553 
                 newch = channel_new("x11",                  newch = channel_new("x11",
                     SSH_CHANNEL_OPENING, newsock, newsock, -1,                      SSH_CHANNEL_OPENING, newsock, newsock, -1,
                     c->local_window_max, c->local_maxpacket,                      c->local_window_max, c->local_maxpacket,
                     0, xstrdup(buf));                      0, xstrdup(buf), 1);
                 if (compat20) {                  if (compat20) {
                         packet_start(SSH2_MSG_CHANNEL_OPEN);                          packet_start(SSH2_MSG_CHANNEL_OPEN);
                         packet_put_cstring("x11");                          packet_put_cstring("x11");
Line 606 
Line 611 
                 newch = channel_new("direct-tcpip",                  newch = channel_new("direct-tcpip",
                     SSH_CHANNEL_OPENING, newsock, newsock, -1,                      SSH_CHANNEL_OPENING, newsock, newsock, -1,
                     c->local_window_max, c->local_maxpacket,                      c->local_window_max, c->local_maxpacket,
                     0, xstrdup(buf));                      0, xstrdup(buf), 1);
                 if (compat20) {                  if (compat20) {
                         packet_start(SSH2_MSG_CHANNEL_OPEN);                          packet_start(SSH2_MSG_CHANNEL_OPEN);
                         packet_put_cstring("direct-tcpip");                          packet_put_cstring("direct-tcpip");
Line 1510 
Line 1515 
                     "port listener", SSH_CHANNEL_PORT_LISTENER,                      "port listener", SSH_CHANNEL_PORT_LISTENER,
                     sock, sock, -1,                      sock, sock, -1,
                     CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,                      CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
                     0, xstrdup("port listener"));                      0, xstrdup("port listener"), 1);
                 strlcpy(channels[ch].path, host, sizeof(channels[ch].path));                  strlcpy(channels[ch].path, host, sizeof(channels[ch].path));
                 channels[ch].host_port = host_port;                  channels[ch].host_port = host_port;
                 channels[ch].listening_port = port;                  channels[ch].listening_port = port;
Line 1800 
Line 1805 
                 (void) channel_new("x11 listener",                  (void) channel_new("x11 listener",
                     SSH_CHANNEL_X11_LISTENER, sock, sock, -1,                      SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
                     CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,                      CHAN_X11_WINDOW_DEFAULT, CHAN_X11_PACKET_DEFAULT,
                     0, xstrdup("X11 inet listener"));                      0, xstrdup("X11 inet listener"), 1);
         }          }
   
         /* Return a suitable value for the DISPLAY environment variable. */          /* Return a suitable value for the DISPLAY environment variable. */
Line 2290 
Line 2295 
 }  }
   
 void  void
 channel_set_fds(int id, int rfd, int wfd, int efd, int extusage)  channel_set_fds(int id, int rfd, int wfd, int efd,
       int extusage, int nonblock)
 {  {
         Channel *c = channel_lookup(id);          Channel *c = channel_lookup(id);
         if (c == NULL || c->type != SSH_CHANNEL_LARVAL)          if (c == NULL || c->type != SSH_CHANNEL_LARVAL)
                 fatal("channel_activate for non-larval channel %d.", id);                  fatal("channel_activate for non-larval channel %d.", id);
           channel_register_fds(c, rfd, wfd, efd, extusage, nonblock);
         channel_register_fds(c, rfd, wfd, efd, extusage);  
         c->type = SSH_CHANNEL_OPEN;          c->type = SSH_CHANNEL_OPEN;
         /* XXX window size? */          /* XXX window size? */
         c->local_window = c->local_window_max = c->local_maxpacket * 2;          c->local_window = c->local_window_max = c->local_maxpacket * 2;

Legend:
Removed from v.1.70  
changed lines
  Added in v.1.71