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

Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
David Kupka 2014-10-14 06:54:00 -04:00 committed by Martin Kosek
parent 320ea12373
commit 40f9678289

View File

@ -26,6 +26,7 @@ import os
import sys import sys
import time import time
import dbus import dbus
import shlex
from ipapython import ipautil from ipapython import ipautil
from ipapython import dogtag from ipapython import dogtag
from ipaplatform.paths import paths from ipaplatform.paths import paths
@ -357,7 +358,7 @@ def add_principal_to_cas(principal):
ca = _find_IPA_ca() ca = _find_IPA_ca()
if ca: if ca:
ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper') 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) ext_helper = '%s -k %s' % (ext_helper.strip(), principal)
ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper) 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() ca = _find_IPA_ca()
if ca: if ca:
ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper') ext_helper = ca.prop_if.Get(DBUS_CM_CA_IF, 'external-helper')
if ext_helper and ext_helper.find('-k'): if ext_helper and '-k' in shlex.split(ext_helper):
ext_helper = ext_helper.strip()[0] ext_helper = shlex.split(ext_helper)[0]
ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper) ca.prop_if.Set(DBUS_CM_CA_IF, 'external-helper', ext_helper)