ac7d03
From fef78a011c148f63a08014bbe7ed2d63fe3380bd Mon Sep 17 00:00:00 2001
ac7d03
From: David Kupka <dkupka@redhat.com>
ac7d03
Date: Mon, 20 Mar 2017 12:48:14 +0100
ac7d03
Subject: [PATCH] ipapython.ipautil.nolog_replace: Do not replace empty value
ac7d03
ac7d03
When provided empty value in nolog parameter nolog_replace added 'XXXXXXXX'
ac7d03
three (once for plain value, once for http quoted value and last time for shell
ac7d03
quoted value) times before every character (including terminating '\0') in the string.
ac7d03
ac7d03
https://pagure.io/freeipa/issue/6738
ac7d03
ac7d03
Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
ac7d03
---
ac7d03
 ipapython/ipautil.py | 2 +-
ac7d03
 1 file changed, 1 insertion(+), 1 deletion(-)
ac7d03
ac7d03
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
ac7d03
index 60b4a37fe247624e826d0f6516cb9a25d30ae75d..cd66328e6c9a0f69e6f83582a9d288ac239c5be3 100644
ac7d03
--- a/ipapython/ipautil.py
ac7d03
+++ b/ipapython/ipautil.py
ac7d03
@@ -505,7 +505,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None,
ac7d03
 def nolog_replace(string, nolog):
ac7d03
     """Replace occurences of strings given in `nolog` with XXXXXXXX"""
ac7d03
     for value in nolog:
ac7d03
-        if not isinstance(value, six.string_types):
ac7d03
+        if not value or not isinstance(value, six.string_types):
ac7d03
             continue
ac7d03
 
ac7d03
         quoted = urllib.parse.quote(value)
ac7d03
-- 
ac7d03
2.12.1
ac7d03