Develop and Download Open Source Software

Browse Subversion Repository

Diff of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ssh.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3081 by yutakapon, Thu Dec 27 13:18:47 2007 UTC revision 3082 by yutakapon, Thu Dec 27 15:11:09 2007 UTC
# Line 236  static void ssh2_channel_retry_send_bufc Line 236  static void ssh2_channel_retry_send_bufc
236                  if (size >= c->remote_window)                  if (size >= c->remote_window)
237                          break;                          break;
238    
239                  SSH_channel_send(pvar, c->local_num, -1, buffer_ptr(ch->msg), size);                  if (c->local_num == -1) { // shell or SCP
240                            SSH2_send_channel_data(pvar, c, buffer_ptr(ch->msg), size);
241                    } else { // port-forwarding
242                            SSH_channel_send(pvar, c->local_num, -1, buffer_ptr(ch->msg), size);
243                    }
244    
245                  c->bufchain = ch->next;                  c->bufchain = ch->next;
246    
# Line 3410  static int SSH_scp_transaction(PTInstVar Line 3414  static int SSH_scp_transaction(PTInstVar
3414    
3415                  strncpy_s(c->scp.sendfilefull, sizeof(c->scp.sendfilefull), sendfile, _TRUNCATE);                  strncpy_s(c->scp.sendfilefull, sizeof(c->scp.sendfilefull), sendfile, _TRUNCATE);
3416                  strncpy_s(c->scp.sendfile, sizeof(c->scp.sendfile), sendfile, _TRUNCATE);                  strncpy_s(c->scp.sendfile, sizeof(c->scp.sendfile), sendfile, _TRUNCATE);
3417                    c->scp.sendfp = fp;     // file pointer
3418          }          }
3419    
3420          // setup SCP data          // setup SCP data
# Line 3446  error: Line 3451  error:
3451  int SSH_start_scp(PTInstVar pvar, char *sendfile)  int SSH_start_scp(PTInstVar pvar, char *sendfile)
3452  {  {
3453          return SSH_scp_transaction(pvar, sendfile, TOLOCAL);          return SSH_scp_transaction(pvar, sendfile, TOLOCAL);
3454            //return SSH_scp_transaction(pvar, "remote5.bin", FROMREMOTE);
3455  }  }
3456    
3457    
# Line 6907  done: Line 6913  done:
6913    
6914          notify_verbose_message(pvar, "SSH2_MSG_CHANNEL_REQUEST was sent at handle_SSH2_open_confirm().", LOG_LEVEL_VERBOSE);          notify_verbose_message(pvar, "SSH2_MSG_CHANNEL_REQUEST was sent at handle_SSH2_open_confirm().", LOG_LEVEL_VERBOSE);
6915    
6916          if (wantconfirm == 0) {          if (c->type == TYPE_SHELL) {
6917                  handle_SSH2_channel_success(pvar);                  if (wantconfirm == 0) {
6918                            handle_SSH2_channel_success(pvar);
6919                    }
6920    
6921            } else if (c->type == TYPE_SCP) {
6922                    // SCPで remote-to-local の場合は、サーバからのファイル送信要求を出す。
6923                    // この時点では remote window size が"0"なので、すぐには送られないが、遅延送信処理で送られる。
6924                    // (2007.12.27 yutaka)
6925                    if (c->scp.dir == FROMREMOTE) {
6926                            char ch = '\0';
6927                            SSH2_send_channel_data(pvar, c, &ch, 1);
6928                    }
6929          }          }
6930    
6931          return TRUE;          return TRUE;
# Line 7118  void ssh2_channel_send_close(PTInstVar p Line 7135  void ssh2_channel_send_close(PTInstVar p
7135          }          }
7136  }  }
7137    
7138    
7139  #define WM_SENDING_FILE (WM_USER + 1)  #define WM_SENDING_FILE (WM_USER + 1)
7140    
7141  typedef struct scp_dlg_parm {  typedef struct scp_dlg_parm {
# Line 7295  static void SSH2_scp_tolocal(PTInstVar p Line 7313  static void SSH2_scp_tolocal(PTInstVar p
7313          }          }
7314  }  }
7315    
7316    static void SSH2_scp_fromremote(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen)
7317    {
7318    
7319    }
7320    
7321    
7322  static void SSH2_scp_response(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen)  static void SSH2_scp_response(PTInstVar pvar, Channel_t *c, unsigned char *data, unsigned int buflen)
7323  {  {
7324          if (buflen == 1 && data[0] == '\0') {  // OK          if (c->scp.dir == FROMREMOTE) {
7325                  if (c->scp.dir == TOLOCAL) {                  SSH2_scp_fromremote(pvar, c, data, buflen);
7326    
7327            } else  if (c->scp.dir == TOLOCAL) {
7328                    if (buflen == 1 && data[0] == '\0') {  // OK
7329                          SSH2_scp_tolocal(pvar, c, data, buflen);                          SSH2_scp_tolocal(pvar, c, data, buflen);
7330                  } else {                  } else {
7331                          //SSH2_scp_fromremote(pvar, c, data, buflen);                          goto error;
7332                  }                  }
7333            }
7334            return;
7335    
7336          } else {  // error  error:
7337            {  // error
7338                  char msg[2048];                  char msg[2048];
7339                  unsigned int i, max;                  unsigned int i, max;
7340    
# Line 7480  static BOOL handle_SSH2_channel_eof(PTIn Line 7510  static BOOL handle_SSH2_channel_eof(PTIn
7510                  // TODO:                  // TODO:
7511                  return FALSE;                  return FALSE;
7512          }          }
7513          if (c->type != TYPE_SHELL) {          if (c->type == TYPE_PORTFWD) {
7514                  FWD_channel_input_eof(pvar, c->local_num);                  FWD_channel_input_eof(pvar, c->local_num);
7515          }          }
7516    

Legend:
Removed from v.3081  
changed lines
  Added in v.3082

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26