aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authormatthew <matthew@FreeBSD.org>2016-01-28 18:11:32 +0800
committermatthew <matthew@FreeBSD.org>2016-01-28 18:11:32 +0800
commit7773769649dfd632f6ad3da8be304a66f53e5fff (patch)
tree6b8751cd9c57ae4613e0cd2917750d7a4d6ae345 /sysutils
parente0b9e49101033f93beb451a1a14e91b027ab6352 (diff)
downloadfreebsd-ports-gnome-7773769649dfd632f6ad3da8be304a66f53e5fff.tar.gz
freebsd-ports-gnome-7773769649dfd632f6ad3da8be304a66f53e5fff.tar.zst
freebsd-ports-gnome-7773769649dfd632f6ad3da8be304a66f53e5fff.zip
Backport upstream patch to fix overquoting of commands run via su
PR: 206591 Submitted by: leeb@ratnaling.org Approved by: lifanov@mail.lifanov.com (maintainer) Obtained from: https://github.com/ansible/ansible/commit/6bf2f45ff52d252dbada6a1860416fa603be56bd
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/ansible/Makefile5
-rw-r--r--sysutils/ansible/files/extra-patch-6bf2f4531
2 files changed, 34 insertions, 2 deletions
diff --git a/sysutils/ansible/Makefile b/sysutils/ansible/Makefile
index 39badc47ef3e..aa7755955e57 100644
--- a/sysutils/ansible/Makefile
+++ b/sysutils/ansible/Makefile
@@ -3,7 +3,7 @@
PORTNAME= ansible
PORTVERSION?= 2.0.0.2
-PORTREVISION?= 2
+PORTREVISION?= 3
CATEGORIES= sysutils python
MASTER_SITES= http://releases.ansible.com/ansible/
@@ -18,7 +18,8 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}yaml>0:${PORTSDIR}/devel/py-yaml \
${PYTHON_PKGNAMEPREFIX}paramiko>0:${PORTSDIR}/security/py-paramiko \
${PYTHON_PKGNAMEPREFIX}Jinja2>0:${PORTSDIR}/devel/py-Jinja2
-EXTRA_PATCHES?= ${FILESDIR}/extra-patch-8647fdc
+EXTRA_PATCHES?= ${FILESDIR}/extra-patch-8647fdc \
+ ${FILESDIR}/extra-patch-6bf2f45
NO_ARCH= yes
USES= cpe python:2 shebangfix
diff --git a/sysutils/ansible/files/extra-patch-6bf2f45 b/sysutils/ansible/files/extra-patch-6bf2f45
new file mode 100644
index 000000000000..3e4d2da1f4e9
--- /dev/null
+++ b/sysutils/ansible/files/extra-patch-6bf2f45
@@ -0,0 +1,31 @@
+--- lib/ansible/playbook/play_context.py.orig 2016-01-14 22:33:27 UTC
++++ lib/ansible/playbook/play_context.py
+@@ -446,8 +446,10 @@ class PlayContext(Base):
+
+ if self.become_method == 'sudo':
+ # If we have a password, we run sudo with a randomly-generated
+- # prompt set using -p. Otherwise we run it with -n, which makes
++ # prompt set using -p. Otherwise we run it with default -n, which makes
+ # it fail if it would have prompted for a password.
++ # Cannot rely on -n as it can be removed from defaults, which should be
++ # done for older versions of sudo that do not support the option.
+ #
+ # Passing a quoted compound command to sudo (or sudo -s)
+ # directly doesn't work, so we shellquote it with pipes.quote()
+@@ -463,12 +465,14 @@ class PlayContext(Base):
+
+ elif self.become_method == 'su':
+
++ # passing code ref to examine prompt as simple string comparisson isn't good enough with su
+ def detect_su_prompt(data):
+ SU_PROMPT_LOCALIZATIONS_RE = re.compile("|".join(['(\w+\'s )?' + x + ' ?: ?' for x in SU_PROMPT_LOCALIZATIONS]), flags=re.IGNORECASE)
+ return bool(SU_PROMPT_LOCALIZATIONS_RE.match(data))
+-
+ prompt = detect_su_prompt
+- becomecmd = '%s %s %s -c "%s -c %s"' % (exe, flags, self.become_user, executable, success_cmd)
++
++ su_success_cmd = '%s -c %s' % (executable, success_cmd) # this is here cause su too succeptible to overquoting
++ becomecmd = '%s %s %s -c %s' % (exe, flags, self.become_user, su_success_cmd) #works with sh
+
+ elif self.become_method == 'pbrun':
+