[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.74 and 1.75

version 1.74, 2000/11/30 22:54:31 version 1.75, 2000/12/05 20:34:09
Line 346 
Line 346 
 }  }
   
 void  void
   channel_pre_connecting(Channel *c, fd_set * readset, fd_set * writeset)
   {
           debug3("channel %d: waiting for connection", c->self);
           FD_SET(c->sock, writeset);
   }
   
   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 685 
Line 692 
         }          }
 }  }
   
   void
   channel_post_connecting(Channel *c, fd_set * readset, fd_set * writeset)
   {
           if (FD_ISSET(c->sock, writeset)) {
                   int err = 0;
                   int sz = sizeof(err);
                   c->type = SSH_CHANNEL_OPEN;
                   if (getsockopt(c->sock, SOL_SOCKET, SO_ERROR, (char *)&err, &sz) < 0) {
                           debug("getsockopt SO_ERROR failed");
                   } else {
                           if (err == 0) {
                                   debug("channel %d: connected)", c->self);
                           } else {
                                   debug("channel %d: not connected: %s",
                                       c->self, strerror(err));
                                   chan_read_failed(c);
                                   chan_write_failed(c);
                           }
                   }
           }
   }
   
 int  int
 channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)  channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset)
 {  {
Line 843 
Line 872 
         channel_pre[SSH_CHANNEL_RPORT_LISTENER] =       &channel_pre_listener;          channel_pre[SSH_CHANNEL_RPORT_LISTENER] =       &channel_pre_listener;
         channel_pre[SSH_CHANNEL_X11_LISTENER] =         &channel_pre_listener;          channel_pre[SSH_CHANNEL_X11_LISTENER] =         &channel_pre_listener;
         channel_pre[SSH_CHANNEL_AUTH_SOCKET] =          &channel_pre_listener;          channel_pre[SSH_CHANNEL_AUTH_SOCKET] =          &channel_pre_listener;
           channel_pre[SSH_CHANNEL_CONNECTING] =           &channel_pre_connecting;
   
         channel_post[SSH_CHANNEL_OPEN] =                &channel_post_open_2;          channel_post[SSH_CHANNEL_OPEN] =                &channel_post_open_2;
         channel_post[SSH_CHANNEL_PORT_LISTENER] =       &channel_post_port_listener;          channel_post[SSH_CHANNEL_PORT_LISTENER] =       &channel_post_port_listener;
         channel_post[SSH_CHANNEL_RPORT_LISTENER] =      &channel_post_port_listener;          channel_post[SSH_CHANNEL_RPORT_LISTENER] =      &channel_post_port_listener;
         channel_post[SSH_CHANNEL_X11_LISTENER] =        &channel_post_x11_listener;          channel_post[SSH_CHANNEL_X11_LISTENER] =        &channel_post_x11_listener;
         channel_post[SSH_CHANNEL_AUTH_SOCKET] =         &channel_post_auth_listener;          channel_post[SSH_CHANNEL_AUTH_SOCKET] =         &channel_post_auth_listener;
           channel_post[SSH_CHANNEL_CONNECTING] =          &channel_post_connecting;
 }  }
   
 void  void
Line 861 
Line 892 
         channel_pre[SSH_CHANNEL_AUTH_SOCKET] =          &channel_pre_listener;          channel_pre[SSH_CHANNEL_AUTH_SOCKET] =          &channel_pre_listener;
         channel_pre[SSH_CHANNEL_INPUT_DRAINING] =       &channel_pre_input_draining;          channel_pre[SSH_CHANNEL_INPUT_DRAINING] =       &channel_pre_input_draining;
         channel_pre[SSH_CHANNEL_OUTPUT_DRAINING] =      &channel_pre_output_draining;          channel_pre[SSH_CHANNEL_OUTPUT_DRAINING] =      &channel_pre_output_draining;
           channel_pre[SSH_CHANNEL_CONNECTING] =           &channel_pre_connecting;
   
         channel_post[SSH_CHANNEL_OPEN] =                &channel_post_open_1;          channel_post[SSH_CHANNEL_OPEN] =                &channel_post_open_1;
         channel_post[SSH_CHANNEL_X11_LISTENER] =        &channel_post_x11_listener;          channel_post[SSH_CHANNEL_X11_LISTENER] =        &channel_post_x11_listener;
         channel_post[SSH_CHANNEL_PORT_LISTENER] =       &channel_post_port_listener;          channel_post[SSH_CHANNEL_PORT_LISTENER] =       &channel_post_port_listener;
         channel_post[SSH_CHANNEL_AUTH_SOCKET] =         &channel_post_auth_listener;          channel_post[SSH_CHANNEL_AUTH_SOCKET] =         &channel_post_auth_listener;
         channel_post[SSH_CHANNEL_OUTPUT_DRAINING] =     &channel_post_output_drain_13;          channel_post[SSH_CHANNEL_OUTPUT_DRAINING] =     &channel_post_output_drain_13;
           channel_post[SSH_CHANNEL_CONNECTING] =          &channel_post_connecting;
 }  }
   
 void  void
Line 877 
Line 910 
         channel_pre[SSH_CHANNEL_X11_LISTENER] =         &channel_pre_listener;          channel_pre[SSH_CHANNEL_X11_LISTENER] =         &channel_pre_listener;
         channel_pre[SSH_CHANNEL_PORT_LISTENER] =        &channel_pre_listener;          channel_pre[SSH_CHANNEL_PORT_LISTENER] =        &channel_pre_listener;
         channel_pre[SSH_CHANNEL_AUTH_SOCKET] =          &channel_pre_listener;          channel_pre[SSH_CHANNEL_AUTH_SOCKET] =          &channel_pre_listener;
           channel_pre[SSH_CHANNEL_CONNECTING] =           &channel_pre_connecting;
   
         channel_post[SSH_CHANNEL_X11_LISTENER] =        &channel_post_x11_listener;          channel_post[SSH_CHANNEL_X11_LISTENER] =        &channel_post_x11_listener;
         channel_post[SSH_CHANNEL_PORT_LISTENER] =       &channel_post_port_listener;          channel_post[SSH_CHANNEL_PORT_LISTENER] =       &channel_post_port_listener;
         channel_post[SSH_CHANNEL_AUTH_SOCKET] =         &channel_post_auth_listener;          channel_post[SSH_CHANNEL_AUTH_SOCKET] =         &channel_post_auth_listener;
         channel_post[SSH_CHANNEL_OPEN] =                &channel_post_open_1;          channel_post[SSH_CHANNEL_OPEN] =                &channel_post_open_1;
           channel_post[SSH_CHANNEL_CONNECTING] =          &channel_post_connecting;
 }  }
   
 void  void
Line 1397 
Line 1432 
                 case SSH_CHANNEL_RPORT_LISTENER:                  case SSH_CHANNEL_RPORT_LISTENER:
                 case SSH_CHANNEL_CLOSED:                  case SSH_CHANNEL_CLOSED:
                 case SSH_CHANNEL_AUTH_SOCKET:                  case SSH_CHANNEL_AUTH_SOCKET:
                   case SSH_CHANNEL_CONNECTING:    /* XXX ??? */
                         continue;                          continue;
                 case SSH_CHANNEL_LARVAL:                  case SSH_CHANNEL_LARVAL:
                         if (!compat20)                          if (!compat20)
Line 1446 
Line 1482 
                         continue;                          continue;
                 case SSH_CHANNEL_LARVAL:                  case SSH_CHANNEL_LARVAL:
                 case SSH_CHANNEL_OPENING:                  case SSH_CHANNEL_OPENING:
                   case SSH_CHANNEL_CONNECTING:
                 case SSH_CHANNEL_OPEN:                  case SSH_CHANNEL_OPEN:
                 case SSH_CHANNEL_X11_OPEN:                  case SSH_CHANNEL_X11_OPEN:
                 case SSH_CHANNEL_INPUT_DRAINING:                  case SSH_CHANNEL_INPUT_DRAINING:
Line 1696 
Line 1733 
                         error("socket: %.100s", strerror(errno));                          error("socket: %.100s", strerror(errno));
                         continue;                          continue;
                 }                  }
                   if (fcntl(sock, F_SETFL, O_NDELAY) < 0)
                           fatal("connect_to: F_SETFL: %s", strerror(errno));
                 /* Connect to the host/port. */                  /* Connect to the host/port. */
                 if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) {                  if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0 &&
                       errno != EINPROGRESS) {
                         error("connect %.100s port %s: %.100s", ntop, strport,                          error("connect %.100s port %s: %.100s", ntop, strport,
                             strerror(errno));                              strerror(errno));
                         close(sock);                          close(sock);
Line 1783 
Line 1823 
         sock = denied ? -1 : channel_connect_to(host, host_port);          sock = denied ? -1 : channel_connect_to(host, host_port);
         if (sock > 0) {          if (sock > 0) {
                 /* Allocate a channel for this connection. */                  /* Allocate a channel for this connection. */
                 newch = channel_allocate(SSH_CHANNEL_OPEN, sock, originator_string);                  newch = channel_allocate(SSH_CHANNEL_CONNECTING,
                       sock, originator_string);
   /*XXX delay answer? */
                 channels[newch].remote_id = remote_channel;                  channels[newch].remote_id = remote_channel;
   
                 packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);                  packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION);

Legend:
Removed from v.1.74  
changed lines
  Added in v.1.75