|
Lines 200-209
Link Here
|
| 200 |
struct passwd *pwd; |
200 |
struct passwd *pwd; |
| 201 |
uid_t userid; |
201 |
uid_t userid; |
| 202 |
int errs, remin, remout; |
202 |
int errs, remin, remout; |
| 203 |
int pflag, iamremote, iamrecursive, targetshouldbedirectory; |
203 |
int pflag, iamremote, iamrecursive, targetshouldbedirectory, ignorelinks; |
| 204 |
|
204 |
|
| 205 |
#define CMDNEEDS 64 |
205 |
#define CMDNEEDS 64 |
| 206 |
char cmd[CMDNEEDS]; /* must hold "rcp -r -p -d\0" */ |
206 |
char cmd[CMDNEEDS]; /* must hold "scp -v -r -p -s -d\0" */ |
| 207 |
|
207 |
|
| 208 |
int response(void); |
208 |
int response(void); |
| 209 |
void rsource(char *, struct stat *); |
209 |
void rsource(char *, struct stat *); |
|
Lines 229-235
Link Here
|
| 229 |
addargs(&args, "-oClearAllForwardings yes"); |
229 |
addargs(&args, "-oClearAllForwardings yes"); |
| 230 |
|
230 |
|
| 231 |
fflag = tflag = 0; |
231 |
fflag = tflag = 0; |
| 232 |
while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1) |
232 |
while ((ch = getopt(argc, argv, "dfl:prstvBCc:i:P:q1246S:o:F:")) != -1) |
| 233 |
switch (ch) { |
233 |
switch (ch) { |
| 234 |
/* User-visible flags. */ |
234 |
/* User-visible flags. */ |
| 235 |
case '1': |
235 |
case '1': |
|
Lines 263-268
Link Here
|
| 263 |
case 'r': |
263 |
case 'r': |
| 264 |
iamrecursive = 1; |
264 |
iamrecursive = 1; |
| 265 |
break; |
265 |
break; |
|
|
266 |
case 's': |
| 267 |
ignorelinks = 1; |
| 268 |
break; |
| 266 |
case 'S': |
269 |
case 'S': |
| 267 |
ssh_program = xstrdup(optarg); |
270 |
ssh_program = xstrdup(optarg); |
| 268 |
break; |
271 |
break; |
|
Lines 321-329
Link Here
|
| 321 |
remin = remout = -1; |
324 |
remin = remout = -1; |
| 322 |
do_cmd_pid = -1; |
325 |
do_cmd_pid = -1; |
| 323 |
/* Command to be executed on remote system using "ssh". */ |
326 |
/* Command to be executed on remote system using "ssh". */ |
| 324 |
(void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s", |
327 |
(void) snprintf(cmd, sizeof cmd, "scp%s%s%s%s%s", |
| 325 |
verbose_mode ? " -v" : "", |
328 |
verbose_mode ? " -v" : "", |
| 326 |
iamrecursive ? " -r" : "", pflag ? " -p" : "", |
329 |
iamrecursive ? " -r" : "", ignorelinks ? " -s" : "", |
|
|
330 |
pflag ? " -p" : "", |
| 327 |
targetshouldbedirectory ? " -d" : ""); |
331 |
targetshouldbedirectory ? " -d" : ""); |
| 328 |
|
332 |
|
| 329 |
(void) signal(SIGPIPE, lostconn); |
333 |
(void) signal(SIGPIPE, lostconn); |
|
Lines 455-462
Link Here
|
| 455 |
len = strlen(_PATH_CP) + strlen(argv[i]) + |
459 |
len = strlen(_PATH_CP) + strlen(argv[i]) + |
| 456 |
strlen(argv[argc - 1]) + 20; |
460 |
strlen(argv[argc - 1]) + 20; |
| 457 |
bp = xmalloc(len); |
461 |
bp = xmalloc(len); |
| 458 |
(void) snprintf(bp, len, "exec %s%s%s %s %s", _PATH_CP, |
462 |
(void)snprintf(bp, len, "exec %s%s%s%s %s %s", _PATH_CP, |
| 459 |
iamrecursive ? " -r" : "", pflag ? " -p" : "", |
463 |
iamrecursive ? " -r" : "", ignorelinks ? " -s" : "", |
|
|
464 |
pflag ? " -p" : "", |
| 460 |
argv[i], argv[argc - 1]); |
465 |
argv[i], argv[argc - 1]); |
| 461 |
if (verbose_mode) |
466 |
if (verbose_mode) |
| 462 |
fprintf(stderr, "Executing: %s\n", bp); |
467 |
fprintf(stderr, "Executing: %s\n", bp); |
|
Lines 516-521
Link Here
|
| 516 |
name); |
521 |
name); |
| 517 |
goto next; |
522 |
goto next; |
| 518 |
} |
523 |
} |
|
|
524 |
if (ignorelinks) { |
| 525 |
if (lstat(name, &stb) < 0) |
| 526 |
goto syserr; |
| 527 |
if (S_ISLNK(stb.st_mode)) |
| 528 |
goto next; |
| 529 |
} |
| 519 |
if ((fd = open(name, O_RDONLY, 0)) < 0) |
530 |
if ((fd = open(name, O_RDONLY, 0)) < 0) |
| 520 |
goto syserr; |
531 |
goto syserr; |
| 521 |
if (fstat(fd, &stb) < 0) { |
532 |
if (fstat(fd, &stb) < 0) { |
|
Lines 1019-1025
Link Here
|
| 1019 |
usage(void) |
1030 |
usage(void) |
| 1020 |
{ |
1031 |
{ |
| 1021 |
(void) fprintf(stderr, |
1032 |
(void) fprintf(stderr, |
| 1022 |
"usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]\n" |
1033 |
"usage: scp [-1246BCpqrsv] [-c cipher] [-F ssh_config] [-i identity_file]\n" |
| 1023 |
" [-l limit] [-o ssh_option] [-P port] [-S program]\n" |
1034 |
" [-l limit] [-o ssh_option] [-P port] [-S program]\n" |
| 1024 |
" [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); |
1035 |
" [[user@]host1:]file1 [...] [[user@]host2:]file2\n"); |
| 1025 |
exit(1); |
1036 |
exit(1); |