summaryrefslogtreecommitdiff
path: root/lib/Net/OpenSSH
diff options
context:
space:
mode:
authorFlorian Schlichting <fsfs@debian.org>2015-08-18 18:15:16 +0200
committerFlorian Schlichting <fsfs@debian.org>2015-08-18 18:15:16 +0200
commitf205c147abe36c1a3043cf68d9ff1bcfd6fcc534 (patch)
tree2d3e9acc46223fe9ad7672ba24155879a0394c36 /lib/Net/OpenSSH
parenta5b394ff4bfd1c0f10f5dab078424e9f57a81a83 (diff)
Imported Upstream version 0.64
Diffstat (limited to 'lib/Net/OpenSSH')
-rw-r--r--lib/Net/OpenSSH/ConnectionCache.pm11
-rw-r--r--lib/Net/OpenSSH/Constants.pm21
-rw-r--r--lib/Net/OpenSSH/ShellQuoter.pm3
-rw-r--r--lib/Net/OpenSSH/ShellQuoter/POSIX.pm2
4 files changed, 32 insertions, 5 deletions
diff --git a/lib/Net/OpenSSH/ConnectionCache.pm b/lib/Net/OpenSSH/ConnectionCache.pm
index cf2ae29..d182114 100644
--- a/lib/Net/OpenSSH/ConnectionCache.pm
+++ b/lib/Net/OpenSSH/ConnectionCache.pm
@@ -7,7 +7,7 @@ use Data::Dumper;
use Scalar::Util qw(weaken);
our $MAX_SIZE = 20;
-my %cache;
+our %cache;
sub _factory {
my $class = shift;
@@ -45,6 +45,8 @@ sub _factory {
$Net::OpenSSH::FACTORY = \&_factory;
+sub clean_cache { %cache = () }
+
END { %cache = () }
1;
@@ -74,9 +76,14 @@ C<$Net::OpenSSH::ConnectionCache::MAX_SIZE> controls the cache
size. Once as many connections are allocated, the module will try to
free any of them before allocating a new one.
+The function C<clean_cache> makes the module forget (and close) all
+the cached connections:
+
+ Net::OpenSSH::ConnectionCache::clean_cache();
+
=head1 COPYRIGHT AND LICENSE
-Copyright (C) 2011 by Salvador FandiE<ntilde>o
+Copyright (C) 2011, 2014 by Salvador FandiE<ntilde>o
(sfandino@yahoo.com)
This library is free software; you can redistribute it and/or modify
diff --git a/lib/Net/OpenSSH/Constants.pm b/lib/Net/OpenSSH/Constants.pm
index 42fa6de..f1ef3cc 100644
--- a/lib/Net/OpenSSH/Constants.pm
+++ b/lib/Net/OpenSSH/Constants.pm
@@ -5,10 +5,11 @@ our $VERSION = '0.51_07';
use strict;
use warnings;
use Carp;
+use Scalar::Util ();
require Exporter;
our @ISA = qw(Exporter);
-our %EXPORT_TAGS = (error => []);
+our %EXPORT_TAGS = (error => [], _state => []);
my %error = ( OSSH_MASTER_FAILED => 1,
OSSH_SLAVE_FAILED => 2,
@@ -26,6 +27,22 @@ for my $key (keys %error) {
push @{$EXPORT_TAGS{error}}, $key
}
+my @states = qw(_STATE_START
+ _STATE_LOGIN
+ _STATE_AWAITING_MUX
+ _STATE_RUNNING
+ _STATE_KILLING
+ _STATE_GONE
+ _STATE_STOPPED);
+
+my $last_value;
+for my $state (@states) {
+ no strict 'refs';
+ my $value = Scalar::Util::dualvar(++$last_value, $state);
+ *{$state} = sub () { $value };
+ push @{$EXPORT_TAGS{_state}}, $state
+}
+
our @EXPORT_OK = map { @{$EXPORT_TAGS{$_}} } keys %EXPORT_TAGS;
$EXPORT_TAGS{all} = [@EXPORT_OK];
@@ -55,7 +72,7 @@ This module exports the following constants:
OSSH_SLAVE_TIMEOUT - slave process timeout
OSSH_SLAVE_CMD_FAILED - child process exited with a non zero status
OSSH_SLAVE_SFTP_FAILED - creation of SFTP client failed
- OSS_ENCODING_ERROR - some error related to the encoding/decoding of strings happened
+ OSSH_ENCODING_ERROR - some error related to the encoding/decoding of strings happened
=back
diff --git a/lib/Net/OpenSSH/ShellQuoter.pm b/lib/Net/OpenSSH/ShellQuoter.pm
index e9939d6..ece197a 100644
--- a/lib/Net/OpenSSH/ShellQuoter.pm
+++ b/lib/Net/OpenSSH/ShellQuoter.pm
@@ -13,7 +13,10 @@ my %alias = (bash => 'POSIX',
dash => 'POSIX',
pdksh => 'POSIX',
mksh => 'POSIX',
+ lksh => 'POSIX',
zsh => 'POSIX',
+ fizsh => 'POSIX',
+ posh => 'POSIX',
tcsh => 'csh');
sub quoter {
diff --git a/lib/Net/OpenSSH/ShellQuoter/POSIX.pm b/lib/Net/OpenSSH/ShellQuoter/POSIX.pm
index 21f6125..5de7c68 100644
--- a/lib/Net/OpenSSH/ShellQuoter/POSIX.pm
+++ b/lib/Net/OpenSSH/ShellQuoter/POSIX.pm
@@ -7,7 +7,7 @@ use Carp;
sub new { __PACKAGE__ }
my $noquote_class = '.\\w/\\-@,:';
-my $glob_class = '*?\\[\\],{}:!^~';
+my $glob_class = '*?\\[\\],\\{\\}:!^~';
sub quote {
shift;