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

Diff for /src/usr.bin/ssh/mux.c between version 1.96 and 1.97

version 1.96, 2023/03/08 04:43:12 version 1.97, 2023/06/20 23:59:33
Line 26 
Line 26 
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <poll.h>  #include <poll.h>
   #include <limits.h>
 #include <signal.h>  #include <signal.h>
 #include <stdarg.h>  #include <stdarg.h>
 #include <stddef.h>  #include <stddef.h>
Line 947 
Line 948 
 {  {
         Channel *nc;          Channel *nc;
         char *chost = NULL;          char *chost = NULL;
         u_int cport, i, j;          u_int _cport, i, j;
         int r, new_fd[2];          int ok = 0, cport, r, new_fd[2];
         struct mux_stdio_confirm_ctx *cctx;          struct mux_stdio_confirm_ctx *cctx;
   
         if ((r = sshbuf_skip_string(m)) != 0 || /* reserved */          if ((r = sshbuf_skip_string(m)) != 0 || /* reserved */
             (r = sshbuf_get_cstring(m, &chost, NULL)) != 0 ||              (r = sshbuf_get_cstring(m, &chost, NULL)) != 0 ||
             (r = sshbuf_get_u32(m, &cport)) != 0) {              (r = sshbuf_get_u32(m, &_cport)) != 0) {
                 free(chost);                  free(chost);
                 error_f("malformed message");                  error_f("malformed message");
                 return -1;                  return -1;
         }          }
           if (_cport == (u_int)PORT_STREAMLOCAL)
                   cport = PORT_STREAMLOCAL;
           else if (_cport <= INT_MAX)
                   cport = (int)_cport;
           else {
                   free(chost);
                   error_f("invalid port 0x%x", _cport);
                   return -1;
           }
   
         debug2_f("channel %d: stdio fwd to %s:%u", c->self, chost, cport);          debug2_f("channel %d: stdio fwd to %s:%d", c->self, chost, cport);
   
         /* Gather fds from client */          /* Gather fds from client */
         for(i = 0; i < 2; i++) {          for(i = 0; i < 2; i++) {
Line 992 
Line 1002 
   
         if (options.control_master == SSHCTL_MASTER_ASK ||          if (options.control_master == SSHCTL_MASTER_ASK ||
             options.control_master == SSHCTL_MASTER_AUTO_ASK) {              options.control_master == SSHCTL_MASTER_AUTO_ASK) {
                 if (!ask_permission("Allow forward to %s:%u? ",                  if (cport == PORT_STREAMLOCAL) {
                     chost, cport)) {                          ok = ask_permission("Allow forward to path %s", chost);
                   } else {
                           ok = ask_permission("Allow forward to [%s]:%d? ",
                               chost, cport);
                   }
                   if (!ok) {
                         debug2_f("stdio fwd refused by user");                          debug2_f("stdio fwd refused by user");
                         reply_error(reply, MUX_S_PERMISSION_DENIED, rid,                          reply_error(reply, MUX_S_PERMISSION_DENIED, rid,
                             "Permission denied");                              "Permission denied");

Legend:
Removed from v.1.96  
changed lines
  Added in v.1.97