From 3586f9f3074c4700e5b1944402ded1ddf7629d78 Mon Sep 17 00:00:00 2001 From: Hans de Graaff Date: Mon, 6 Apr 2020 11:35:36 +0200 Subject: 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 --- .../files/sshkit-0.1.0-multiple-servers.patch | 51 ++++++++++++++++++++++ dev-ruby/sshkit-sudo/sshkit-sudo-0.1.0-r1.ebuild | 24 ++++++++++ 2 files changed, 75 insertions(+) create mode 100644 dev-ruby/sshkit-sudo/files/sshkit-0.1.0-multiple-servers.patch create mode 100644 dev-ruby/sshkit-sudo/sshkit-sudo-0.1.0-r1.ebuild (limited to 'dev-ruby/sshkit-sudo') 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 +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" -- cgit v1.2.3-65-gdbad