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

Diff for /src/usr.bin/ssh/nchan.c between version 1.70 and 1.71

version 1.70, 2019/06/28 13:35:04 version 1.71, 2020/10/18 11:32:01
Line 183 
Line 183 
         switch (c->istate) {          switch (c->istate) {
         case CHAN_INPUT_WAIT_DRAIN:          case CHAN_INPUT_WAIT_DRAIN:
                 if (!c->have_remote_id)                  if (!c->have_remote_id)
                         fatal("%s: channel %d: no remote_id",                          fatal_f("channel %d: no remote_id", c->self);
                             __func__, c->self);  
                 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_EOF)) != 0 ||                  if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_EOF)) != 0 ||
                     (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||                      (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
                     (r = sshpkt_send(ssh)) != 0)                      (r = sshpkt_send(ssh)) != 0)
                         fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r));                          fatal_fr(r, "send CHANNEL_EOF");
                 c->flags |= CHAN_EOF_SENT;                  c->flags |= CHAN_EOF_SENT;
                 break;                  break;
         default:          default:
Line 212 
Line 211 
                 error("channel %d: already sent close", c->self);                  error("channel %d: already sent close", c->self);
         } else {          } else {
                 if (!c->have_remote_id)                  if (!c->have_remote_id)
                         fatal("%s: channel %d: no remote_id",                          fatal_f("channel %d: no remote_id", c->self);
                             __func__, c->self);  
                 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_CLOSE)) != 0 ||                  if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_CLOSE)) != 0 ||
                     (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||                      (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
                     (r = sshpkt_send(ssh)) != 0)                      (r = sshpkt_send(ssh)) != 0)
                         fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r));                          fatal_fr(r, "send CHANNEL_EOF");
                 c->flags |= CHAN_CLOSE_SENT;                  c->flags |= CHAN_CLOSE_SENT;
         }          }
 }  }
Line 236 
Line 234 
         if (!(datafellows & SSH_NEW_OPENSSH))          if (!(datafellows & SSH_NEW_OPENSSH))
                 return;                  return;
         if (!c->have_remote_id)          if (!c->have_remote_id)
                 fatal("%s: channel %d: no remote_id", __func__, c->self);                  fatal_f("channel %d: no remote_id", c->self);
         if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_REQUEST)) != 0 ||          if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_REQUEST)) != 0 ||
             (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||              (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
             (r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0 ||              (r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0 ||
             (r = sshpkt_put_u8(ssh, 0)) != 0 ||              (r = sshpkt_put_u8(ssh, 0)) != 0 ||
             (r = sshpkt_send(ssh)) != 0)              (r = sshpkt_send(ssh)) != 0)
                 fatal("%s: send CHANNEL_EOF: %s", __func__, ssh_err(r));                  fatal_fr(r, "send CHANNEL_EOF");
 }  }
   
 /* shared */  /* shared */
Line 374 
Line 372 
         if (c->type == SSH_CHANNEL_LARVAL)          if (c->type == SSH_CHANNEL_LARVAL)
                 return;                  return;
         /* shutdown failure is allowed if write failed already */          /* shutdown failure is allowed if write failed already */
         debug2("channel %d: %s (i%d o%d sock %d wfd %d efd %d [%s])",          debug2_f("channel %d: (i%d o%d sock %d wfd %d efd %d [%s])",
             c->self, __func__, c->istate, c->ostate, c->sock, c->wfd, c->efd,              c->self, c->istate, c->ostate, c->sock, c->wfd, c->efd,
             channel_format_extended_usage(c));              channel_format_extended_usage(c));
         if (c->sock != -1) {          if (c->sock != -1) {
                 if (shutdown(c->sock, SHUT_WR) == -1) {                  if (shutdown(c->sock, SHUT_WR) == -1) {
                         debug2("channel %d: %s: shutdown() failed for "                          debug2_f("channel %d: shutdown() failed for "
                             "fd %d [i%d o%d]: %.100s", c->self, __func__,                              "fd %d [i%d o%d]: %.100s", c->self, c->sock,
                             c->sock, c->istate, c->ostate,                              c->istate, c->ostate, strerror(errno));
                             strerror(errno));  
                 }                  }
         } else {          } else {
                 if (channel_close_fd(ssh, &c->wfd) < 0) {                  if (channel_close_fd(ssh, &c->wfd) < 0) {
                         logit("channel %d: %s: close() failed for "                          logit_f("channel %d: close() failed for "
                             "fd %d [i%d o%d]: %.100s",                              "fd %d [i%d o%d]: %.100s", c->self, c->wfd,
                             c->self, __func__, c->wfd, c->istate, c->ostate,                              c->istate, c->ostate, strerror(errno));
                             strerror(errno));  
                 }                  }
         }          }
 }  }
Line 399 
Line 395 
 {  {
         if (c->type == SSH_CHANNEL_LARVAL)          if (c->type == SSH_CHANNEL_LARVAL)
                 return;                  return;
         debug2("channel %d: %s (i%d o%d sock %d wfd %d efd %d [%s])",          debug2_f("channel %d: (i%d o%d sock %d wfd %d efd %d [%s])",
             c->self, __func__, c->istate, c->ostate, c->sock, c->rfd, c->efd,              c->self, c->istate, c->ostate, c->sock, c->rfd, c->efd,
             channel_format_extended_usage(c));              channel_format_extended_usage(c));
         if (c->sock != -1) {          if (c->sock != -1) {
                 if (shutdown(c->sock, SHUT_RD) == -1) {                  if (shutdown(c->sock, SHUT_RD) == -1) {
                         error("channel %d: %s: shutdown() failed for "                          error_f("channel %d: shutdown() failed for "
                             "fd %d [i%d o%d]: %.100s",                              "fd %d [i%d o%d]: %.100s", c->self, c->sock,
                             c->self, __func__, c->sock, c->istate, c->ostate,                              c->istate, c->ostate, strerror(errno));
                             strerror(errno));  
                 }                  }
         } else {          } else {
                 if (channel_close_fd(ssh, &c->rfd) < 0) {                  if (channel_close_fd(ssh, &c->rfd) < 0) {
                         logit("channel %d: %s: close() failed for "                          logit_f("channel %d: close() failed for "
                             "fd %d [i%d o%d]: %.100s",                              "fd %d [i%d o%d]: %.100s", c->self, c->rfd,
                             c->self, __func__, c->rfd, c->istate, c->ostate,                              c->istate, c->ostate, strerror(errno));
                             strerror(errno));  
                 }                  }
         }          }
 }  }
Line 427 
Line 421 
         if (c->extended_usage != CHAN_EXTENDED_READ &&          if (c->extended_usage != CHAN_EXTENDED_READ &&
             c->extended_usage != CHAN_EXTENDED_IGNORE)              c->extended_usage != CHAN_EXTENDED_IGNORE)
                 return;                  return;
         debug2("channel %d: %s (i%d o%d sock %d wfd %d efd %d [%s])",          debug_f("channel %d: (i%d o%d sock %d wfd %d efd %d [%s])",
             c->self, __func__, c->istate, c->ostate, c->sock, c->rfd, c->efd,              c->self, c->istate, c->ostate, c->sock, c->rfd, c->efd,
             channel_format_extended_usage(c));              channel_format_extended_usage(c));
         if (channel_close_fd(ssh, &c->efd) < 0) {          if (channel_close_fd(ssh, &c->efd) < 0) {
                 logit("channel %d: %s: close() failed for "                  logit_f("channel %d: close() failed for "
                     "extended fd %d [i%d o%d]: %.100s",                      "extended fd %d [i%d o%d]: %.100s", c->self, c->efd,
                     c->self, __func__, c->efd, c->istate, c->ostate,                      c->istate, c->ostate, strerror(errno));
                     strerror(errno));  
         }          }
 }  }

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