summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2011-09-26 08:27:01 +0200
committerRob Crittenden <rcritten@redhat.com>2011-10-04 20:12:58 -0400
commit209bcb0b98daf7edbea2c7428f6fe5f109e74e49 (patch)
tree97027dc57e041c01f815e687e08c2f84c4466e2f /ipapython
parent3fb40170cb70a87515ec9d3466099fa3417a4086 (diff)
downloadfreeipa-209bcb0b98daf7edbea2c7428f6fe5f109e74e49.tar.gz
freeipa-209bcb0b98daf7edbea2c7428f6fe5f109e74e49.tar.xz
freeipa-209bcb0b98daf7edbea2c7428f6fe5f109e74e49.zip
Work around pkisilent bugs.
Check directory manager password and certificate subject base for invalid characters. (https://bugzilla.redhat.com/show_bug.cgi?id=658641) Shell-escape pkisilent command-line arguments. (https://bugzilla.redhat.com/show_bug.cgi?id=741180) ticket 1636
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/ipautil.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index dfeaa9e0b..6e037926c 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -196,6 +196,9 @@ def write_tmp_file(txt):
return fd
+def shell_quote(string):
+ return "'" + string.replace("'", "'\\''") + "'"
+
def run(args, stdin=None, raiseonerr=True,
nolog=(), env=None, capture_output=True):
"""
@@ -248,7 +251,8 @@ def run(args, stdin=None, raiseonerr=True,
continue
quoted = urllib2.quote(value)
- for nolog_value in (value, quoted):
+ shquoted = shell_quote(value)
+ for nolog_value in (shquoted, value, quoted):
if capture_output:
stdout = stdout.replace(nolog_value, 'XXXXXXXX')
stderr = stderr.replace(nolog_value, 'XXXXXXXX')