summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--scp.c32
2 files changed, 27 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c3ae0375..7c7297731 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -29,6 +29,11 @@
29 [session.c] 29 [session.c]
30 replace close() loop for fds 3->64 with closefrom(); 30 replace close() loop for fds 3->64 with closefrom();
31 ok markus deraadt dtucker 31 ok markus deraadt dtucker
32 - djm@cvs.openbsd.org 2010/11/26 05:52:49
33 [scp.c]
34 Pass through ssh command-line flags and options when doing remote-remote
35 transfers, e.g. to enable agent forwarding which is particularly useful
36 in this case; bz#1837 ok dtucker@
32 37
3320101124 3820101124
34 - (dtucker) [platform.c session.c] Move the getluid call out of session.c and 39 - (dtucker) [platform.c session.c] Move the getluid call out of session.c and
diff --git a/scp.c b/scp.c
index a4066c668..774e602f2 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: scp.c,v 1.167 2010/09/22 22:58:51 djm Exp $ */ 1/* $OpenBSD: scp.c,v 1.168 2010/11/26 05:52:49 djm Exp $ */
2/* 2/*
3 * scp - secure remote copy. This is basically patched BSD rcp which 3 * scp - secure remote copy. This is basically patched BSD rcp which
4 * uses ssh to do the data transfer (instead of using rcmd). 4 * uses ssh to do the data transfer (instead of using rcmd).
@@ -122,6 +122,7 @@ int do_cmd(char *host, char *remuser, char *cmd, int *fdin, int *fdout);
122 122
123/* Struct for addargs */ 123/* Struct for addargs */
124arglist args; 124arglist args;
125arglist remote_remote_args;
125 126
126/* Bandwidth limit */ 127/* Bandwidth limit */
127long long limit_kbps = 0; 128long long limit_kbps = 0;
@@ -334,12 +335,13 @@ main(int argc, char **argv)
334 __progname = ssh_get_progname(argv[0]); 335 __progname = ssh_get_progname(argv[0]);
335 336
336 memset(&args, '\0', sizeof(args)); 337 memset(&args, '\0', sizeof(args));
337 args.list = NULL; 338 memset(&remote_remote_args, '\0', sizeof(remote_remote_args));
339 args.list = remote_remote_args.list = NULL;
338 addargs(&args, "%s", ssh_program); 340 addargs(&args, "%s", ssh_program);
339 addargs(&args, "-x"); 341 addargs(&args, "-x");
340 addargs(&args, "-oForwardAgent no"); 342 addargs(&args, "-oForwardAgent=no");
341 addargs(&args, "-oPermitLocalCommand no"); 343 addargs(&args, "-oPermitLocalCommand=no");
342 addargs(&args, "-oClearAllForwardings yes"); 344 addargs(&args, "-oClearAllForwardings=yes");
343 345
344 fflag = tflag = 0; 346 fflag = tflag = 0;
345 while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1) 347 while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q1246S:o:F:")) != -1)
@@ -351,20 +353,26 @@ main(int argc, char **argv)
351 case '6': 353 case '6':
352 case 'C': 354 case 'C':
353 addargs(&args, "-%c", ch); 355 addargs(&args, "-%c", ch);
356 addargs(&remote_remote_args, "-%c", ch);
354 break; 357 break;
355 case 'o': 358 case 'o':
356 case 'c': 359 case 'c':
357 case 'i': 360 case 'i':
358 case 'F': 361 case 'F':
362 addargs(&remote_remote_args, "-%c", ch);
363 addargs(&remote_remote_args, "%s", optarg);
359 addargs(&args, "-%c", ch); 364 addargs(&args, "-%c", ch);
360 addargs(&args, "%s", optarg); 365 addargs(&args, "%s", optarg);
361 break; 366 break;
362 case 'P': 367 case 'P':
368 addargs(&remote_remote_args, "-p");
369 addargs(&remote_remote_args, "%s", optarg);
363 addargs(&args, "-p"); 370 addargs(&args, "-p");
364 addargs(&args, "%s", optarg); 371 addargs(&args, "%s", optarg);
365 break; 372 break;
366 case 'B': 373 case 'B':
367 addargs(&args, "-oBatchmode yes"); 374 addargs(&remote_remote_args, "-oBatchmode=yes");
375 addargs(&args, "-oBatchmode=yes");
368 break; 376 break;
369 case 'l': 377 case 'l':
370 limit_kbps = strtonum(optarg, 1, 100 * 1024 * 1024, 378 limit_kbps = strtonum(optarg, 1, 100 * 1024 * 1024,
@@ -385,10 +393,12 @@ main(int argc, char **argv)
385 break; 393 break;
386 case 'v': 394 case 'v':
387 addargs(&args, "-v"); 395 addargs(&args, "-v");
396 addargs(&remote_remote_args, "-v");
388 verbose_mode = 1; 397 verbose_mode = 1;
389 break; 398 break;
390 case 'q': 399 case 'q':
391 addargs(&args, "-q"); 400 addargs(&args, "-q");
401 addargs(&remote_remote_args, "-q");
392 showprogress = 0; 402 showprogress = 0;
393 break; 403 break;
394 404
@@ -492,6 +502,7 @@ toremote(char *targ, int argc, char **argv)
492 char *bp, *host, *src, *suser, *thost, *tuser, *arg; 502 char *bp, *host, *src, *suser, *thost, *tuser, *arg;
493 arglist alist; 503 arglist alist;
494 int i; 504 int i;
505 u_int j;
495 506
496 memset(&alist, '\0', sizeof(alist)); 507 memset(&alist, '\0', sizeof(alist));
497 alist.list = NULL; 508 alist.list = NULL;
@@ -522,12 +533,13 @@ toremote(char *targ, int argc, char **argv)
522 if (src) { /* remote to remote */ 533 if (src) { /* remote to remote */
523 freeargs(&alist); 534 freeargs(&alist);
524 addargs(&alist, "%s", ssh_program); 535 addargs(&alist, "%s", ssh_program);
525 if (verbose_mode)
526 addargs(&alist, "-v");
527 addargs(&alist, "-x"); 536 addargs(&alist, "-x");
528 addargs(&alist, "-oClearAllForwardings yes"); 537 addargs(&alist, "-oClearAllForwardings=yes");
529 addargs(&alist, "-n"); 538 addargs(&alist, "-n");
530 539 for (j = 0; j < remote_remote_args.num; j++) {
540 addargs(&alist, "%s",
541 remote_remote_args.list[j]);
542 }
531 *src++ = 0; 543 *src++ = 0;
532 if (*src == 0) 544 if (*src == 0)
533 src = "."; 545 src = ".";