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:13:11 -0400
commit428d8c4a2d4e45cd78a185f7824a76daacce8e16 (patch)
treea87ba3a37e67e3409152889c53ada9a2dbb4da29 /ipapython
parent5bc83239640aa111e83720d8f5d4eec911a79451 (diff)
downloadfreeipa-428d8c4a2d4e45cd78a185f7824a76daacce8e16.tar.gz
freeipa-428d8c4a2d4e45cd78a185f7824a76daacce8e16.tar.xz
freeipa-428d8c4a2d4e45cd78a185f7824a76daacce8e16.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')