summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Graaff <hans@degraaff.org>2020-04-06 11:35:36 +0200
committerHans de Graaff <hans@degraaff.org>2020-04-06 11:35:36 +0200
commit3586f9f3074c4700e5b1944402ded1ddf7629d78 (patch)
tree2d51539254634cbbfd9733a7e631a2587f968d7d /dev-ruby/sshkit-sudo
parentgentoo repo now has a ruby25 version again (diff)
downloadgraaff-3586f9f3074c4700e5b1944402ded1ddf7629d78.tar.gz
graaff-3586f9f3074c4700e5b1944402ded1ddf7629d78.tar.bz2
graaff-3586f9f3074c4700e5b1944402ded1ddf7629d78.zip
dev-ruby/sshkit-sudo: add patch for multiple servers
Package-Manager: Portage-2.3.89, Repoman-2.3.20 Signed-off-by: Hans de Graaff <hans@degraaff.org>
Diffstat (limited to 'dev-ruby/sshkit-sudo')
-rw-r--r--dev-ruby/sshkit-sudo/files/sshkit-0.1.0-multiple-servers.patch51
-rw-r--r--dev-ruby/sshkit-sudo/sshkit-sudo-0.1.0-r1.ebuild24
2 files changed, 75 insertions, 0 deletions
diff --git a/dev-ruby/sshkit-sudo/files/sshkit-0.1.0-multiple-servers.patch b/dev-ruby/sshkit-sudo/files/sshkit-0.1.0-multiple-servers.patch
new file mode 100644
index 00000000..f9123494
--- /dev/null
+++ b/dev-ruby/sshkit-sudo/files/sshkit-0.1.0-multiple-servers.patch
@@ -0,0 +1,51 @@
+https://github.com/kentaroi/sshkit-sudo/pull/9
+
+From 722dedb4abd69f5916d4a45e318c7aac151c7dfe Mon Sep 17 00:00:00 2001
+From: Charlie Savage <cfis@zerista.com>
+Date: Mon, 20 Jun 2016 01:19:47 -0600
+Subject: [PATCH] Fix #8 by protecting the password prompt code via a Mutex so
+ only one server can call it at a time.
+
+---
+ lib/sshkit/sudo/interaction_handler.rb | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+diff --git a/lib/sshkit/sudo/interaction_handler.rb b/lib/sshkit/sudo/interaction_handler.rb
+index 42abd3e..9d4e270 100644
+--- a/lib/sshkit/sudo/interaction_handler.rb
++++ b/lib/sshkit/sudo/interaction_handler.rb
+@@ -1,6 +1,8 @@
+ module SSHKit
+ module Sudo
+ class DefaultInteractionHandler
++ MUTEX = Mutex.new
++
+ def wrong_password; self.class.wrong_password; end
+ def password_prompt; self.class.password_prompt; end
+
+@@ -12,15 +14,17 @@ def on_data(command, stream_name, data, channel)
+ SSHKit::Sudo.password_cache[password_cache_key(command.host)] = nil
+ end
+ if data =~ password_prompt
+- key = password_cache_key(command.host)
+- pass = SSHKit::Sudo.password_cache[key]
+- unless pass
+- print data
+- pass = $stdin.noecho(&:gets)
+- puts ''
+- SSHKit::Sudo.password_cache[key] = pass
++ MUTEX.synchronize do
++ key = password_cache_key(command.host)
++ pass = SSHKit::Sudo.password_cache[key]
++ unless pass
++ print data
++ pass = $stdin.noecho(&:gets)
++ puts ''
++ SSHKit::Sudo.password_cache[key] = pass
++ end
++ channel.send_data(pass)
+ end
+- channel.send_data(pass)
+ end
+ end
+
diff --git a/dev-ruby/sshkit-sudo/sshkit-sudo-0.1.0-r1.ebuild b/dev-ruby/sshkit-sudo/sshkit-sudo-0.1.0-r1.ebuild
new file mode 100644
index 00000000..06f64807
--- /dev/null
+++ b/dev-ruby/sshkit-sudo/sshkit-sudo-0.1.0-r1.ebuild
@@ -0,0 +1,24 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+USE_RUBY="ruby24 ruby25 ruby26"
+
+RUBY_FAKEGEM_TASK_TEST=""
+
+RUBY_FAKEGEM_EXTRADOC="README.md"
+
+inherit ruby-fakegem
+
+DESCRIPTION="SSHKit extension, for sudo operation with password input"
+HOMEPAGE="https://github.com/kentaroi/sshkit-sudo"
+LICENSE="MIT"
+
+KEYWORDS="~amd64"
+SLOT="0"
+IUSE=""
+
+PATCHES=( "${FILESDIR}/sshkit-0.1.0-multiple-servers.patch" )
+
+ruby_add_rdepend ">=dev-ruby/sshkit-1.8"