URL: https://github.com/freeipa/freeipa/pull/630
Author: dkupka
 Title: #630: ipapython.ipautil.nolog_replace: Do not replace empty value
Action: opened

PR body:
"""
When provided empty value in nolog parameter nolog_replace added 'XXXXXXXX'
three (once for plain value, once for http quoted value and last time for shell
quoted value) times before every character (including terminating '\0') in the 
string.

https://pagure.io/freeipa/issue/6738
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/630/head:pr630
git checkout pr630
From 68a4e59bb963ad3aa12e69c37a2843e44fed8a86 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Mon, 20 Mar 2017 12:48:14 +0100
Subject: [PATCH] ipapython.ipautil.nolog_replace: Do not replace empty value

When provided empty value in nolog parameter nolog_replace added 'XXXXXXXX'
three (once for plain value, once for http quoted value and last time for shell
quoted value) times before every character (including terminating '\0') in the string.

https://pagure.io/freeipa/issue/6738
---
 ipapython/ipautil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index 60b4a37..cd66328 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -505,7 +505,7 @@ def run(args, stdin=None, raiseonerr=True, nolog=(), env=None,
 def nolog_replace(string, nolog):
     """Replace occurences of strings given in `nolog` with XXXXXXXX"""
     for value in nolog:
-        if not isinstance(value, six.string_types):
+        if not value or not isinstance(value, six.string_types):
             continue
 
         quoted = urllib.parse.quote(value)
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to