From 22d10c9e704b1e7438f1bf48551210531ccdfc7f Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 15 Mar 2002 10:43:38 +0000 Subject: [PATCH] - patch from Anthony Awtrey to use s/=/ / in -o options again if OpenSSH v1 is detected --- Changes | 6 +++++- SSH.pm | 26 +++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/Changes b/Changes index 0e6ef41..fd7ed17 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ Revision history for Perl extension Net::SSH. -0.05 unreleased +0.06 unreleased + - patch from Anthony Awtrey to use s/=/ / in -o + options again if OpenSSH v1 is detected + +0.05 Fri Feb 15 15:46:00 2002 - brainfart mis-credit 0.04 Fri Feb 15 14:05:06 2002 diff --git a/SSH.pm b/SSH.pm index 8e55a8a..b5391d5 100644 --- a/SSH.pm +++ b/SSH.pm @@ -1,7 +1,7 @@ package Net::SSH; use strict; -use vars qw($VERSION @ISA @EXPORT_OK $ssh $DEBUG); +use vars qw($VERSION @ISA @EXPORT_OK $ssh $equalspace $DEBUG); use Exporter; use IO::File; use IPC::Open2; @@ -9,12 +9,25 @@ use IPC::Open3; @ISA = qw(Exporter); @EXPORT_OK = qw( ssh issh ssh_cmd sshopen2 sshopen3 ); -$VERSION = '0.05'; +$VERSION = '0.06'; $DEBUG = 0; $ssh = "ssh"; +my $reader = IO::File->new(); +my $writer = IO::File->new(); +my $error = IO::File->new(); +open3($writer, $reader, $error, $ssh, '-V'); +my $ssh_version = <$error>; +chomp($ssh_version); +$ssh_version =~ s/.*OpenSSH[-|_](\w+?)\.\w+?\.\w+?.*/$1/g; +if ($ssh_version == 1) { + $equalspace = " "; +} else { + $equalspace = "="; +} + =head1 NAME Net::SSH - Perl extension for secure shell @@ -52,7 +65,7 @@ Calls ssh in batch mode. sub ssh { my($host, @command) = @_; - my @cmd = ($ssh, '-o', 'BatchMode=yes', $host, @command); + my @cmd = ($ssh, '-o', 'BatchMode'.$equalspace.'yes', $host, @command); warn "[Net::SSH::ssh] executing ". join(' ', @cmd). "\n" if $DEBUG; system(@cmd); @@ -110,7 +123,7 @@ Connects the supplied filehandles to the ssh process (in batch mode). sub sshopen2 { my($host, $reader, $writer, @command) = @_; - open2($reader, $writer, $ssh, '-o', 'BatchMode=yes', $host, @command); + open2($reader, $writer, $ssh, '-o', 'BatchMode'.$equalspace.'yes', $host, @command); } =item sshopen3 HOST, WRITER, READER, ERROR, COMMAND [, ARGS ... ] @@ -121,7 +134,7 @@ Connects the supplied filehandles to the ssh process (in batch mode). sub sshopen3 { my($host, $writer, $reader, $error, @command) = @_; - open3($writer, $reader, $error, $ssh, '-o', 'BatchMode=yes', $host, @command); + open3($writer, $reader, $error, $ssh, '-o', 'BatchMode'.$equalspace.'yes', $host, @command); } sub _yesno { @@ -172,6 +185,9 @@ John Harrison contributed an example for the documentation. Martin Langhoff contributed the ssh_cmd command, and Jeff Finucane updated it and took care of the 0.04 release. +Anthony Awtrey contributed a fix for those still using +OpenSSH v1. + =head1 COPYRIGHT Copyright (c) 2002 Ivan Kohler. -- 2.11.0