Bugzilla – Attachment 2683 Details for
Bug 831
Allow agent forwarding in sftp & scp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add -A option to scp and sftp (updated, git format-patch)
0001-Add-A-flag-to-scp-and-sftp.patch (text/plain), 3.68 KB, created by
kl_other+mindrot
on 2015-08-17 01:56:46 AEST
(
hide
)
Description:
Add -A option to scp and sftp (updated, git format-patch)
Filename:
MIME Type:
Creator:
kl_other+mindrot
Created:
2015-08-17 01:56:46 AEST
Size:
3.68 KB
patch
obsolete
>From 8a351cf5af67d412650b2a300b12aa61dcce6682 Mon Sep 17 00:00:00 2001 >From: Kenny Levinsen <kl_online@icloud.com> >Date: Sun, 16 Aug 2015 17:52:32 +0200 >Subject: [PATCH] Add -A option to scp and sftp > >--- > scp.1 | 6 +++++- > scp.c | 14 ++++++++++---- > sftp.1 | 6 +++++- > sftp.c | 11 ++++++++--- > 4 files changed, 28 insertions(+), 9 deletions(-) > >diff --git a/scp.1 b/scp.1 >index 279b0d7..89121d0 100644 >--- a/scp.1 >+++ b/scp.1 >@@ -19,7 +19,7 @@ > .Sh SYNOPSIS > .Nm scp > .Bk -words >-.Op Fl 12346BCpqrv >+.Op Fl 12346ABCpqrv > .Op Fl c Ar cipher > .Op Fl F Ar ssh_config > .Op Fl i Ar identity_file >@@ -86,6 +86,10 @@ to use IPv4 addresses only. > Forces > .Nm > to use IPv6 addresses only. >+.It Fl A >+Enables >+.Xr ssh-agent 1 >+forwarding (default is disabled). > .It Fl B > Selects batch mode (prevents asking for passwords or passphrases). > .It Fl C >diff --git a/scp.c b/scp.c >index 593fe89..deb29ec 100644 >--- a/scp.c >+++ b/scp.c >@@ -369,7 +369,7 @@ void usage(void); > int > main(int argc, char **argv) > { >- int ch, fflag, tflag, status, n; >+ int ch, fflag, tflag, aflag, status, n; > char *targ, **newargv; > const char *errstr; > extern char *optarg; >@@ -391,14 +391,17 @@ main(int argc, char **argv) > args.list = remote_remote_args.list = NULL; > addargs(&args, "%s", ssh_program); > addargs(&args, "-x"); >- addargs(&args, "-oForwardAgent=no"); >+ addargs(&args, "-oForwardX11=no"); > addargs(&args, "-oPermitLocalCommand=no"); > addargs(&args, "-oClearAllForwardings=yes"); > >- fflag = tflag = 0; >- while ((ch = getopt(argc, argv, "dfl:prtvBCc:i:P:q12346S:o:F:")) != -1) >+ fflag = tflag = aflag = 0; >+ while ((ch = getopt(argc, argv, "Adfl:prtvBCc:i:P:q12346S:o:F:")) != -1) > switch (ch) { > /* User-visible flags. */ >+ case 'A': >+ aflag = 1; >+ break; > case '1': > case '2': > case '4': >@@ -475,6 +478,9 @@ main(int argc, char **argv) > default: > usage(); > } >+ >+ addargs(&args, "-oForwardAgent=%s", aflag ? "yes" : "no"); >+ addargs(&remote_remote_args, "-oForwardAgent=%s", aflag ? "yes" : "no"); > argc -= optind; > argv += optind; > >diff --git a/sftp.1 b/sftp.1 >index 214f011..a2a9565 100644 >--- a/sftp.1 >+++ b/sftp.1 >@@ -31,7 +31,7 @@ > .Sh SYNOPSIS > .Nm sftp > .Bk -words >-.Op Fl 1246aCfpqrv >+.Op Fl 1246AaCfpqrv > .Op Fl B Ar buffer_size > .Op Fl b Ar batchfile > .Op Fl c Ar cipher >@@ -107,6 +107,10 @@ to use IPv4 addresses only. > Forces > .Nm > to use IPv6 addresses only. >+.It Fl A >+Enables >+.Xr ssh-agent 1 >+forwarding (default is disabled). > .It Fl a > Attempt to continue interrupted transfers rather than overwriting > existing partial or complete copies of files. >diff --git a/sftp.c b/sftp.c >index cb9b967..b90e949 100644 >--- a/sftp.c >+++ b/sftp.c >@@ -2233,7 +2233,7 @@ usage(void) > int > main(int argc, char **argv) > { >- int in, out, ch, err; >+ int in, out, ch, err, aflag; > char *host = NULL, *userhost, *cp, *file2 = NULL; > int debug_level = 0, sshver = 2; > char *file1 = NULL, *sftp_server = NULL; >@@ -2257,19 +2257,22 @@ main(int argc, char **argv) > args.list = NULL; > addargs(&args, "%s", ssh_program); > addargs(&args, "-oForwardX11 no"); >- addargs(&args, "-oForwardAgent no"); > addargs(&args, "-oPermitLocalCommand no"); > addargs(&args, "-oClearAllForwardings yes"); > > ll = SYSLOG_LEVEL_INFO; > infile = stdin; > >+ aflag = 0; > while ((ch = getopt(argc, argv, >- "1246afhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) { >+ "1246AafhpqrvCc:D:i:l:o:s:S:b:B:F:P:R:")) != -1) { > switch (ch) { > /* Passed through to ssh(1) */ > case '4': > case '6': >+ case 'A': >+ aflag = 1; >+ break; > case 'C': > addargs(&args, "-%c", ch); > break; >@@ -2363,6 +2366,8 @@ main(int argc, char **argv) > } > } > >+ addargs(&args, "-oForwardAgent=%s", aflag ? "yes" : "no"); >+ > if (!isatty(STDERR_FILENO)) > showprogress = 0; > >-- >2.5.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 831
:
594
|
2683
|
3328
|
3437