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

Diff for /src/usr.bin/ssh/scp.c between version 1.54 and 1.55

version 1.54, 2001/02/07 18:01:17 version 1.55, 2001/02/08 14:38:54
Line 310 
Line 310 
   
         remin = remout = -1;          remin = remout = -1;
         /* Command to be executed on remote system using "ssh". */          /* Command to be executed on remote system using "ssh". */
         (void) sprintf(cmd, "scp%s%s%s%s", verbose_mode ? " -v" : "",          (void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s",
               verbose_mode ? " -v" : "",
             iamrecursive ? " -r" : "", pflag ? " -p" : "",              iamrecursive ? " -r" : "", pflag ? " -p" : "",
             targetshouldbedirectory ? " -d" : "");              targetshouldbedirectory ? " -d" : "");
   
Line 381 
Line 382 
                                         suser = pwd->pw_name;                                          suser = pwd->pw_name;
                                 else if (!okname(suser))                                  else if (!okname(suser))
                                         continue;                                          continue;
                                 sprintf(bp,                                  snprintf(bp, len,
                                     "%s%s -x -o'FallBackToRsh no' -n -l %s %s %s %s '%s%s%s:%s'",                                      "%s%s -x -o'FallBackToRsh no' -n "
                                       "-l %s %s %s %s '%s%s%s:%s'",
                                     ssh_program, verbose_mode ? " -v" : "",                                      ssh_program, verbose_mode ? " -v" : "",
                                     suser, host, cmd, src,                                      suser, host, cmd, src,
                                     tuser ? tuser : "", tuser ? "@" : "",                                      tuser ? tuser : "", tuser ? "@" : "",
                                     thost, targ);                                      thost, targ);
                         } else {                          } else {
                                 host = cleanhostname(argv[i]);                                  host = cleanhostname(argv[i]);
                                 sprintf(bp,                                  snprintf(bp, len,
                                     "exec %s%s -x -o'FallBackToRsh no' -n %s %s %s '%s%s%s:%s'",                                      "exec %s%s -x -o'FallBackToRsh no' -n %s "
                                       "%s %s '%s%s%s:%s'",
                                     ssh_program, verbose_mode ? " -v" : "",                                      ssh_program, verbose_mode ? " -v" : "",
                                     host, cmd, src,                                      host, cmd, src,
                                     tuser ? tuser : "", tuser ? "@" : "",                                      tuser ? tuser : "", tuser ? "@" : "",
Line 404 
Line 407 
                         if (remin == -1) {                          if (remin == -1) {
                                 len = strlen(targ) + CMDNEEDS + 20;                                  len = strlen(targ) + CMDNEEDS + 20;
                                 bp = xmalloc(len);                                  bp = xmalloc(len);
                                 (void) sprintf(bp, "%s -t %s", cmd, targ);                                  (void) snprintf(bp, len, "%s -t %s", cmd, targ);
                                 host = cleanhostname(thost);                                  host = cleanhostname(thost);
                                 if (do_cmd(host, tuser, bp, &remin,                                  if (do_cmd(host, tuser, bp, &remin,
                                     &remout, argc) < 0)                                      &remout, argc) < 0)
Line 431 
Line 434 
                         len = strlen(_PATH_CP) + strlen(argv[i]) +                          len = strlen(_PATH_CP) + strlen(argv[i]) +
                             strlen(argv[argc - 1]) + 20;                              strlen(argv[argc - 1]) + 20;
                         bp = xmalloc(len);                          bp = xmalloc(len);
                         (void) sprintf(bp, "exec %s%s%s %s %s", _PATH_CP,                          (void) snprintf(bp, len, "exec %s%s%s %s %s", _PATH_CP,
                             iamrecursive ? " -r" : "", pflag ? " -p" : "",                              iamrecursive ? " -r" : "", pflag ? " -p" : "",
                             argv[i], argv[argc - 1]);                              argv[i], argv[argc - 1]);
                         if (verbose_mode)                          if (verbose_mode)
Line 458 
Line 461 
                 host = cleanhostname(host);                  host = cleanhostname(host);
                 len = strlen(src) + CMDNEEDS + 20;                  len = strlen(src) + CMDNEEDS + 20;
                 bp = xmalloc(len);                  bp = xmalloc(len);
                 (void) sprintf(bp, "%s -f %s", cmd, src);                  (void) snprintf(bp, len, "%s -f %s", cmd, src);
                 if (do_cmd(host, suser, bp, &remin, &remout, argc) < 0) {                  if (do_cmd(host, suser, bp, &remin, &remout, argc) < 0) {
                         (void) xfree(bp);                          (void) xfree(bp);
                         ++errs;                          ++errs;
Line 515 
Line 518 
                          * Make it compatible with possible future                           * Make it compatible with possible future
                          * versions expecting microseconds.                           * versions expecting microseconds.
                          */                           */
                         (void) sprintf(buf, "T%lu 0 %lu 0\n",                          (void) snprintf(buf, sizeof buf, "T%lu 0 %lu 0\n",
                             (u_long) stb.st_mtime,                              (u_long) stb.st_mtime,
                             (u_long) stb.st_atime);                              (u_long) stb.st_atime);
                         (void) atomicio(write, remout, buf, strlen(buf));                          (void) atomicio(write, remout, buf, strlen(buf));
Line 523 
Line 526 
                                 goto next;                                  goto next;
                 }                  }
 #define FILEMODEMASK    (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)  #define FILEMODEMASK    (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
                 sprintf(buf, "C%04o %lu %s\n",                  snprintf(buf, sizeof buf, "C%04o %lu %s\n",
                     (u_int) (stb.st_mode & FILEMODEMASK),                      (u_int) (stb.st_mode & FILEMODEMASK),
                     (u_long) stb.st_size, last);                      (u_long) stb.st_size, last);
                 if (verbose_mode) {                  if (verbose_mode) {
Line 592 
Line 595 
         else          else
                 last++;                  last++;
         if (pflag) {          if (pflag) {
                 (void) sprintf(path, "T%lu 0 %lu 0\n",                  (void) snprintf(path, sizeof(path), "T%lu 0 %lu 0\n",
                     (u_long) statp->st_mtime,                      (u_long) statp->st_mtime,
                     (u_long) statp->st_atime);                      (u_long) statp->st_atime);
                 (void) atomicio(write, remout, path, strlen(path));                  (void) atomicio(write, remout, path, strlen(path));
Line 601 
Line 604 
                         return;                          return;
                 }                  }
         }          }
         (void) sprintf(path, "D%04o %d %.1024s\n",          (void) snprintf(path, sizeof path, "D%04o %d %.1024s\n",
             (u_int) (statp->st_mode & FILEMODEMASK), 0, last);              (u_int) (statp->st_mode & FILEMODEMASK), 0, last);
         if (verbose_mode)          if (verbose_mode)
                 fprintf(stderr, "Entering directory: %s", path);                  fprintf(stderr, "Entering directory: %s", path);
Line 619 
Line 622 
                         run_err("%s/%s: name too long", name, dp->d_name);                          run_err("%s/%s: name too long", name, dp->d_name);
                         continue;                          continue;
                 }                  }
                 (void) sprintf(path, "%s/%s", name, dp->d_name);                  (void) snprintf(path, sizeof path, "%s/%s", name, dp->d_name);
                 vect[0] = path;                  vect[0] = path;
                 source(1, vect);                  source(1, vect);
         }          }
Line 749 
Line 752 
                         size_t need;                          size_t need;
   
                         need = strlen(targ) + strlen(cp) + 250;                          need = strlen(targ) + strlen(cp) + 250;
                         if (need > cursize)                          if (need > cursize) {
                                   if (namebuf)
                                           xfree(namebuf);
                                 namebuf = xmalloc(need);                                  namebuf = xmalloc(need);
                         (void) sprintf(namebuf, "%s%s%s", targ,                                  cursize = need;
                           }
                           (void) snprintf(namebuf, need, "%s%s%s", targ,
                             *targ ? "/" : "", cp);                              *targ ? "/" : "", cp);
                         np = namebuf;                          np = namebuf;
                 } else                  } else

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55