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

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

version 1.96, 2002/02/06 14:55:15 version 1.97, 2002/03/21 15:17:26
Line 81 
Line 81 
 #include "atomicio.h"  #include "atomicio.h"
 #include "sshtty.h"  #include "sshtty.h"
 #include "misc.h"  #include "misc.h"
   #include "readpass.h"
   
 /* import options */  /* import options */
 extern Options options;  extern Options options;
Line 470 
Line 471 
         }          }
 }  }
   
   static void
   process_cmdline(Buffer *bin, Buffer *bout, Buffer *berr)
   {
           char string[1024];
           void (*handler)(int);
           char *s, *cmd;
           u_short fwd_port, fwd_host_port;
           char buf[1024], sfwd_port[6], sfwd_host_port[6];
           int local = 0;
           int n;
   
           leave_raw_mode();
           handler = signal(SIGINT, SIG_IGN);
           s = read_passphrase("\r\nssh> ", RP_ECHO);
           if (s == NULL)
                   goto out;
           cmd = s;
   
           while (*s && isspace(*s))
                   s++;
   
           if (*s == 0)
                   goto out;
   
           if (strlen(s) < 2 || s[0] != '-' || !(s[1] == 'L' || s[1] == 'R')) {
                   log("Invalid command");
                   goto out;
           }
           if (s[1] == 'L')
                   local = 1;
           if (!local && !compat20) {
                   log("Not supported for SSH protocol version 1");
                   goto out;
           }
   
           s += 2;
           while (*s && isspace(*s))
                   s++;
   
           if (sscanf(s, "%5[0-9]:%255[^:]:%5[0-9]",
               sfwd_port, buf, sfwd_host_port) != 3 &&
               sscanf(s, "%5[0-9]/%255[^/]/%5[0-9]",
               sfwd_port, buf, sfwd_host_port) != 3) {
                   log("Bad forwarding specification");
                   goto out;
           }
           if ((fwd_port = a2port(sfwd_port)) == 0 ||
               (fwd_host_port = a2port(sfwd_host_port)) == 0) {
                   log("Bad forwarding port(s)");
                   goto out;
           }
           if (local) {
                   n = channel_setup_local_fwd_listener(fwd_port, buf,
                       fwd_host_port, options.gateway_ports);
                   if (n <= 0) {
                           log("Port forwarding failed");
                           goto out;
                   }
           } else
                   channel_request_remote_forwarding(fwd_port, buf,
                       fwd_host_port);
           log("Forwarding port");
   out:
           signal(SIGINT, handler);
           enter_raw_mode();
           if (cmd)
                   xfree(cmd);
   }
   
 /* process the characters one by one */  /* process the characters one by one */
 static int  static int
 process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)  process_escapes(Buffer *bin, Buffer *bout, Buffer *berr, char *buf, int len)
Line 574 
Line 644 
 "%c?\r\n\  "%c?\r\n\
 Supported escape sequences:\r\n\  Supported escape sequences:\r\n\
 ~.  - terminate connection\r\n\  ~.  - terminate connection\r\n\
   ~C  - open a command line\r\n\
 ~R  - Request rekey (SSH protocol 2 only)\r\n\  ~R  - Request rekey (SSH protocol 2 only)\r\n\
 ~^Z - suspend ssh\r\n\  ~^Z - suspend ssh\r\n\
 ~#  - list forwarded connections\r\n\  ~#  - list forwarded connections\r\n\
Line 591 
Line 662 
                                 s = channel_open_message();                                  s = channel_open_message();
                                 buffer_append(berr, s, strlen(s));                                  buffer_append(berr, s, strlen(s));
                                 xfree(s);                                  xfree(s);
                                   continue;
   
                           case 'C':
                                   process_cmdline(bin, bout, berr);
                                 continue;                                  continue;
   
                         default:                          default:

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