Subject: | Patch for different port use |
Find a patch to enable the module handling of ports different then
standard SSH (22).
Subject: | Net_SCP.patch |
--- Net/SCP.pm 2007-03-07 02:53:28.000000000 +0100
+++ /usr/local/share/perl/5.8.4/Net/SCP.pm.bak 2004-03-03 09:44:55.000000000 +0100
@@ -31,9 +31,9 @@
#allows user to type a password on tty
#OO interface
- $scp = Net::SCP->new( "hostname", port, "username" );
+ $scp = Net::SCP->new( "hostname", "username" );
#with named params
- $scp = Net::SCP->new( { "host"=>$hostname, "port"=>$port, "user"=>$username } );
+ $scp = Net::SCP->new( { "host"=>$hostname, "user"=>$username } );
$scp->get("filename") or die $scp->{errstr};
$scp->put("filename") or die $scp->{errstr};
#tmtowtdi
@@ -41,7 +41,7 @@
$scp->scp($source, $destination);
#Net::FTP-style
- $scp = Net::SCP->new("hostname", port);
+ $scp = Net::SCP->new("hostname");
$scp->login("user");
$scp->cwd("/dir");
$scp->size("file");
@@ -74,11 +74,10 @@
my($src, $dest, $interact) = @_;
my $flags = '-p';
$flags .= 'r' unless &_islocal($src) && ! -d $src;
- my $port = '-P '.$self->{'port'};
my @cmd;
if ( ( defined($interact) && $interact )
|| ( defined($self->{interact}) && $self->{interact} ) ) {
- @cmd = ( $scp, $flags, $port, $src, $dest );
+ @cmd = ( $scp, $flags, $src, $dest );
print join(' ', @cmd), "\n";
unless ( &_yesno ) {
$self->{errstr} = "User declined";
@@ -86,7 +85,7 @@
}
} else {
$flags .= 'qB';
- @cmd = ( $scp, $flags, $port, $src, $dest );
+ @cmd = ( $scp, $flags, $src, $dest );
}
my($reader, $writer, $error ) =
( new IO::Handle, new IO::Handle, new IO::Handle );
@@ -144,11 +143,10 @@
=item new HOSTNAME [ USER ] | HASHREF
This is the constructor for a new Net::SCP object. You must specify a
-hostname and port, and may optionally provide a user. Alternatively, you may pass a
+hostname, and may optionally provide a user. Alternatively, you may pass a
hashref of named params, with the following keys:
host - hostname
- port - port
user - username
interactive - bool
cwd - current working directory on remote server
@@ -164,7 +162,6 @@
} else {
$self = {
'host' => shift,
- 'port' => shift,
'user' => ( scalar(@_) ? shift : '' ),
'interactive' => 0,
'cwd' => '',
@@ -231,7 +228,7 @@
( new IO::Handle, new IO::Handle, new IO::Handle );
$writer->autoflush(1);
my $pid = sshopen3( $host, $writer, $reader, $error,
- '-p '.$self->{'port'}, '/bin/mkdir', '-p', shell_quote($directory) );
+ '/bin/mkdir', '-p ', shell_quote($directory) );
waitpid $pid, 0;
if ( $? >> 8 ) {
chomp(my $errstr = <$error>);
@@ -263,7 +260,7 @@
$writer->autoflush(1);
#sshopen2($host, $reader, $writer, 'wc', '-c ', shell_quote($file) );
my $pid =
- sshopen3($host, $writer, $reader, $error, '-p '.$self->{'port'}, 'wc', '-c ', shell_quote($file) );
+ sshopen3($host, $writer, $reader, $error, 'wc', '-c ', shell_quote($file) );
waitpid $pid, 0;
if ( $? >> 8 ) {
chomp(my $errstr = <$error>);