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 3084 by yutakapon, Sat Dec 29 10:21:19 2007 UTC revision 3089 by yutakapon, Thu Jan 3 16:15:40 2008 UTC
# Line 91  typedef struct scp { Line 91  typedef struct scp {
91          enum scp_state state;          // SCP state          enum scp_state state;          // SCP state
92          char sendfile[MAX_PATH];       // sending filename          char sendfile[MAX_PATH];       // sending filename
93          char sendfilefull[MAX_PATH];   // sending filename fullpath          char sendfilefull[MAX_PATH];   // sending filename fullpath
94            char dstfile[MAX_PATH];       // sending filename
95          FILE *sendfp;                  // file pointer          FILE *sendfp;                  // file pointer
96          struct _stat filestat;         // file status information          struct _stat filestat;         // file status information
97          HWND progress;          HWND progress;
# Line 3375  void SSH_open_channel(PTInstVar pvar, ui Line 3376  void SSH_open_channel(PTInstVar pvar, ui
3376  //  //
3377  // (2007.12.21 yutaka)  // (2007.12.21 yutaka)
3378  //  //
3379  static int SSH_scp_transaction(PTInstVar pvar, char *sendfile, enum scp_dir direction)  static int SSH_scp_transaction(PTInstVar pvar, char *sendfile, char *dstfile, enum scp_dir direction)
3380  {  {
3381          buffer_t *msg;          buffer_t *msg;
3382          char *s;          char *s;
# Line 3408  static int SSH_scp_transaction(PTInstVar Line 3409  static int SSH_scp_transaction(PTInstVar
3409    
3410                  strncpy_s(c->scp.sendfilefull, sizeof(c->scp.sendfilefull), sendfile, _TRUNCATE);  // full path                  strncpy_s(c->scp.sendfilefull, sizeof(c->scp.sendfilefull), sendfile, _TRUNCATE);  // full path
3411                  ExtractFileName(sendfile, c->scp.sendfile, sizeof(c->scp.sendfile));   // file name only                  ExtractFileName(sendfile, c->scp.sendfile, sizeof(c->scp.sendfile));   // file name only
3412                    if (dstfile == NULL || dstfile[0] == '\0') { // remote file path
3413                            strncpy_s(c->scp.dstfile, sizeof(c->scp.dstfile), c->scp.sendfile, _TRUNCATE);  // full path
3414                    } else {
3415                            strncpy_s(c->scp.dstfile, sizeof(c->scp.dstfile), dstfile, _TRUNCATE);  // full path
3416                    }
3417                  c->scp.sendfp = fp;     // file pointer                  c->scp.sendfp = fp;     // file pointer
3418    
3419                  if (_stat(c->scp.sendfilefull, &st) == 0) {                  if (_stat(c->scp.sendfilefull, &st) == 0) {
# Line 3458  error: Line 3464  error:
3464          return FALSE;          return FALSE;
3465  }  }
3466    
3467  int SSH_start_scp(PTInstVar pvar, char *sendfile)  int SSH_start_scp(PTInstVar pvar, char *sendfile, char *dstfile)
3468  {  {
3469          return SSH_scp_transaction(pvar, sendfile, TOLOCAL);          return SSH_scp_transaction(pvar, sendfile, dstfile, TOLOCAL);
3470    
3471  #if 0  #if 0
3472          //return SSH_scp_transaction(pvar, "bigfile30.dat", FROMREMOTE);          //return SSH_scp_transaction(pvar, "bigfile30.dat", FROMREMOTE);
# Line 6876  static BOOL handle_SSH2_open_confirm(PTI Line 6882  static BOOL handle_SSH2_open_confirm(PTI
6882          if (c->type == TYPE_SCP) {          if (c->type == TYPE_SCP) {
6883                  char sbuf[MAX_PATH + 30];                  char sbuf[MAX_PATH + 30];
6884                  if (c->scp.dir == TOLOCAL) {                  if (c->scp.dir == TOLOCAL) {
6885                          _snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -t %s", c->scp.sendfile);                          _snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -t %s", c->scp.dstfile);
6886    
6887                  } else {                                  } else {                
6888                          _snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -f %s", c->scp.sendfile);                          _snprintf_s(sbuf, sizeof(sbuf), _TRUNCATE, "scp -f %s", c->scp.dstfile);
6889    
6890                  }                  }
6891                  buffer_put_string(msg, sbuf, strlen(sbuf));                  buffer_put_string(msg, sbuf, strlen(sbuf));

Legend:
Removed from v.3084  
changed lines
  Added in v.3089

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