I forget to attach patch for ipa-4-0 branch. Attaching both now.

On 10/15/2014 11:08 AM, David Kupka wrote:
https://fedorahosted.org/freeipa/ticket/4624


_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel


--
David Kupka
From c2808f958c9ee99374aadf808ca01bf7047de509 Mon Sep 17 00:00:00 2001
From: David Kupka <[email protected]>
Date: Tue, 14 Oct 2014 06:54:00 -0400
Subject: [PATCH] Fix typo causing certmonger is provided with wrong path to
 ipa-submit.

Using strip() instead split() caused that only first character of path was specified.
Also using shlex for more robust parsing.

https://fedorahosted.org/freeipa/ticket/4624
---
 ipapython/certmonger.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ipapython/certmonger.py b/ipapython/certmonger.py
index ca8b373924428343fe108c88dfa0904237dfccce..dc6cff966539a288273172b3f3633646c96dd5ab 100644
--- a/ipapython/certmonger.py
+++ b/ipapython/certmonger.py
@@ -26,6 +26,7 @@ import os
 import sys
 import time
 import dbus
+import shlex
 from ipapython import ipautil
 from ipapython import dogtag
 from ipapython.ipa_log_manager import *
@@ -371,7 +372,7 @@ def add_principal_to_cas(principal):
     ca = _find_IPA_ca()
     if ca:
         ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper')
-        if ext_helper and ext_helper.find('-k') == -1:
+        if ext_helper and '-k' not in shlex.split(ext_helper):
             ext_helper = '%s -k %s' % (ext_helper.strip(), principal)
             ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper)
 
@@ -383,8 +384,8 @@ def remove_principal_from_cas():
     ca = _find_IPA_ca()
     if ca:
         ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper')
-        if ext_helper and ext_helper.find('-k'):
-            ext_helper = ext_helper.strip()[0]
+        if ext_helper and '-k' in shlex.split(ext_helper):
+            ext_helper = shlex.split(ext_helper)[0]
             ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper)
 
 
-- 
1.9.3

From ae9d6d00ef5ba2dc61053b5429a0a6a6ac21f086 Mon Sep 17 00:00:00 2001
From: David Kupka <[email protected]>
Date: Tue, 14 Oct 2014 06:54:00 -0400
Subject: [PATCH] Fix typo causing certmonger is provided with wrong path to
 ipa-submit.

Using strip() instead split() caused that only first character of path was specified.
Also using shlex for more robust parsing.

https://fedorahosted.org/freeipa/ticket/4624
---
 ipapython/certmonger.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ipapython/certmonger.py b/ipapython/certmonger.py
index 84f04a62e5e94716310efcd7847bc7f89460b73c..72ae8d5ef063bec495d996b44e6aba2b4e19839f 100644
--- a/ipapython/certmonger.py
+++ b/ipapython/certmonger.py
@@ -26,6 +26,7 @@ import os
 import sys
 import time
 import dbus
+import shlex
 from ipapython import ipautil
 from ipapython import dogtag
 from ipaplatform.paths import paths
@@ -357,7 +358,7 @@ def add_principal_to_cas(principal):
     ca = _find_IPA_ca()
     if ca:
         ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper')
-        if ext_helper and ext_helper.find('-k') == -1:
+        if ext_helper and '-k' not in shlex.split(ext_helper):
             ext_helper = '%s -k %s' % (ext_helper.strip(), principal)
             ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper)
 
@@ -369,8 +370,8 @@ def remove_principal_from_cas():
     ca = _find_IPA_ca()
     if ca:
         ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper')
-        if ext_helper and ext_helper.find('-k'):
-            ext_helper = ext_helper.strip()[0]
+        if ext_helper and '-k' in shlex.split(ext_helper):
+            ext_helper = shlex.split(ext_helper)[0]
             ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper)
 
 
-- 
1.9.3

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to