Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2016 10:11:32 +0000 (UTC)
From:      Matthew Seaman <matthew@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r407405 - in head/sysutils/ansible: . files
Message-ID:  <201601281011.u0SABWk1023474@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: matthew
Date: Thu Jan 28 10:11:32 2016
New Revision: 407405
URL: https://svnweb.freebsd.org/changeset/ports/407405

Log:
  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

Added:
  head/sysutils/ansible/files/extra-patch-6bf2f45   (contents, props changed)
Modified:
  head/sysutils/ansible/Makefile

Modified: head/sysutils/ansible/Makefile
==============================================================================
--- head/sysutils/ansible/Makefile	Thu Jan 28 09:29:33 2016	(r407404)
+++ head/sysutils/ansible/Makefile	Thu Jan 28 10:11:32 2016	(r407405)
@@ -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
 		${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

Added: head/sysutils/ansible/files/extra-patch-6bf2f45
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/ansible/files/extra-patch-6bf2f45	Thu Jan 28 10:11:32 2016	(r407405)
@@ -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':
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601281011.u0SABWk1023474>