Patch for supporting "-L" option in scp
Etienne M. Gagnon
egagnon at j-meg.com
Fri Apr 28 01:45:38 EST 2000
Hi!
I am running Debian with the following package version:
Package: ssh
Version: 1:1.2.3-1
Severity: normal
The "-L" option, to use a non-privileged port, is missing in "scp". Here is a
simple patch that implements this option.
Etienne
--
----------------------------------------------------------------------
Etienne M. Gagnon, M.Sc. e-mail: egagnon at j-meg.com
Author of SableCC: http://www.sable.mcgill.ca/sablecc/
----------------------------------------------------------------------
Index: 0.1/scp.c
--- scp.c
+++ scp.c
@@ -103,6 +103,10 @@
/* This is the port to use in contacting the remote site (is non-NULL). */
char *port = NULL;
+/* This is set to non-zero if non-privileged local port is desired. */
+int use_non_privileged_port = 0;
+
+
/*
* This function executes the given command as the specified user on the
* given host. This returns < 0 if execution fails, and >= 0 otherwise. This
@@ -178,6 +182,8 @@
args[i++] = "-l";
args[i++] = remuser;
}
+ if (use_non_privileged_port)
+ args[i++] = "-P";
args[i++] = host;
args[i++] = cmd;
args[i++] = NULL;
@@ -247,7 +253,7 @@
extern int optind;
fflag = tflag = 0;
- while ((ch = getopt(argc, argv, "dfprtvBCc:i:P:q46")) != EOF)
+ while ((ch = getopt(argc, argv, "dfprtvBCc:i:P:qL46")) != EOF)
switch (ch) {
/* User-visible flags. */
case '4':
@@ -295,6 +301,9 @@
case 'q':
showprogress = 0;
break;
+ case 'L':
+ use_non_privileged_port = 1;
+ break;
case '?':
default:
usage();
@@ -931,7 +940,7 @@
usage()
{
(void) fprintf(stderr,
- "usage: scp [-pqrvC46] [-P port] [-c cipher] [-i identity] f1 f2; or:\n scp
[options] f1 ... fn directory\n");
+ "usage: scp [-pqrvCL46] [-P port] [-c cipher] [-i identity] f1 f2; or:\n scp
[options] f1 ... fn directory\n");
exit(1);
}
-- System Information
Debian Release: 2.2
Kernel Version: Linux www 2.2.13 #1 Tue Nov 30 19:54:46 EST 1999 i586 unknown
Versions of the packages ssh depends on:
ii libc6 2.1.3-8 GNU C Library: Shared
libraries
and Timezone data
ii libpam-modules 0.72-7 Pluggable Authentication
Modules for PAM
ii libpam0g 0.72-7 Pluggable Authentication
Modules library
ii libssl09 0.9.4-5 SSL shared libraries
ii libwrap0 7.6-4 Wietse Venema's TCP wrappers
library
ii zlib1g 1.1.3-5 compression library - runtime
^^^ (Provides virtual package libz1)
More information about the openssh-unix-dev
mailing list