From 209bcb0b98daf7edbea2c7428f6fe5f109e74e49 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Mon, 26 Sep 2011 08:27:01 +0200 Subject: 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 --- ipapython/ipautil.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ipapython/ipautil.py') 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') -- cgit