[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.274 and 1.275

version 1.274, 2008/05/08 06:59:01 version 1.275, 2008/05/08 12:02:23
Line 44 
Line 44 
 #include <sys/un.h>  #include <sys/un.h>
 #include <sys/socket.h>  #include <sys/socket.h>
 #include <sys/time.h>  #include <sys/time.h>
   #include <sys/queue.h>
   
 #include <netinet/in.h>  #include <netinet/in.h>
 #include <arpa/inet.h>  #include <arpa/inet.h>
Line 314 
Line 315 
         c->single_connection = 0;          c->single_connection = 0;
         c->detach_user = NULL;          c->detach_user = NULL;
         c->detach_close = 0;          c->detach_close = 0;
         c->confirm = NULL;          c->open_confirm = NULL;
         c->confirm_ctx = NULL;          c->open_confirm_ctx = NULL;
         c->input_filter = NULL;          c->input_filter = NULL;
         c->output_filter = NULL;          c->output_filter = NULL;
           TAILQ_INIT(&c->status_confirms);
         debug("channel %d: new [%s]", found, remote_name);          debug("channel %d: new [%s]", found, remote_name);
         return c;          return c;
 }  }
Line 374 
Line 376 
 {  {
         char *s;          char *s;
         u_int i, n;          u_int i, n;
           struct channel_confirm *cc;
   
         for (n = 0, i = 0; i < channels_alloc; i++)          for (n = 0, i = 0; i < channels_alloc; i++)
                 if (channels[i])                  if (channels[i])
Line 397 
Line 400 
                 xfree(c->remote_name);                  xfree(c->remote_name);
                 c->remote_name = NULL;                  c->remote_name = NULL;
         }          }
           while ((cc = TAILQ_FIRST(&c->status_confirms)) != NULL) {
                   if (cc->abandon_cb != NULL)
                           cc->abandon_cb(c, cc->ctx);
                   TAILQ_REMOVE(&c->status_confirms, cc, entry);
                   bzero(cc, sizeof(*cc));
                   xfree(cc);
           }
         channels[c->self] = NULL;          channels[c->self] = NULL;
         xfree(c);          xfree(c);
 }  }
Line 655 
Line 665 
 }  }
   
 void  void
 channel_register_confirm(int id, channel_callback_fn *fn, void *ctx)  channel_register_status_confirm(int id, channel_confirm_cb *cb,
       channel_confirm_abandon_cb *abandon_cb, void *ctx)
 {  {
           struct channel_confirm *cc;
           Channel *c;
   
           if ((c = channel_lookup(id)) == NULL)
                   fatal("channel_register_expect: %d: bad id", id);
   
           cc = xmalloc(sizeof(*cc));
           cc->cb = cb;
           cc->abandon_cb = abandon_cb;
           cc->ctx = ctx;
           TAILQ_INSERT_TAIL(&c->status_confirms, cc, entry);
   }
   
   void
   channel_register_open_confirm(int id, channel_callback_fn *fn, void *ctx)
   {
         Channel *c = channel_lookup(id);          Channel *c = channel_lookup(id);
   
         if (c == NULL) {          if (c == NULL) {
                 logit("channel_register_comfirm: %d: bad id", id);                  logit("channel_register_open_comfirm: %d: bad id", id);
                 return;                  return;
         }          }
         c->confirm = fn;          c->open_confirm = fn;
         c->confirm_ctx = ctx;          c->open_confirm_ctx = ctx;
 }  }
   
 void  void
Line 2192 
Line 2219 
         if (compat20) {          if (compat20) {
                 c->remote_window = packet_get_int();                  c->remote_window = packet_get_int();
                 c->remote_maxpacket = packet_get_int();                  c->remote_maxpacket = packet_get_int();
                 if (c->confirm) {                  if (c->open_confirm) {
                         debug2("callback start");                          debug2("callback start");
                         c->confirm(c->self, c->confirm_ctx);                          c->open_confirm(c->self, c->open_confirm_ctx);
                         debug2("callback done");                          debug2("callback done");
                 }                  }
                 debug2("channel %d: open confirm rwindow %u rmax %u", c->self,                  debug2("channel %d: open confirm rwindow %u rmax %u", c->self,
Line 2311 
Line 2338 
         xfree(host);          xfree(host);
 }  }
   
   /* ARGSUSED */
   void
   channel_input_status_confirm(int type, u_int32_t seq, void *ctxt)
   {
           Channel *c;
           struct channel_confirm *cc;
           int remote_id;
   
           /* Reset keepalive timeout */
           keep_alive_timeouts = 0;
   
           remote_id = packet_get_int();
           packet_check_eom();
   
           debug2("channel_input_confirm: type %d id %d", type, remote_id);
   
           if ((c = channel_lookup(remote_id)) == NULL) {
                   logit("channel_input_success_failure: %d: unknown", remote_id);
                   return;
           }
           ;
           if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL)
                   return;
           cc->cb(type, c, cc->ctx);
           TAILQ_REMOVE(&c->status_confirms, cc, entry);
           bzero(cc, sizeof(*cc));
           xfree(cc);
   }
   
 /* -- tcp forwarding */  /* -- tcp forwarding */
   

Legend:
Removed from v.1.274  
changed lines
  Added in v.1.275