diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-09-05 15:44:37 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2013-09-05 15:44:37 -0300 |
commit | b48d9efd98e78b5a90d16bda03d7026756409acb (patch) | |
tree | 290f7896a4f45a227a6009ac4408954719c24bb6 /src | |
parent | 75109de1283be85309d1795d518ef8a8c2ef4f07 (diff) | |
parent | ca1c9e01fecd74150399d5829d3255337be8f10a (diff) |
Merge remote-tracking branch 'kali/bug/fix-polkit-agent' into develop
Diffstat (limited to 'src')
-rw-r--r-- | src/leap/bitmask/services/eip/vpnlaunchers.py | 8 | ||||
-rw-r--r-- | src/leap/bitmask/util/polkit_agent.py | 24 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/leap/bitmask/services/eip/vpnlaunchers.py b/src/leap/bitmask/services/eip/vpnlaunchers.py index 49edc8eb..a50da8b9 100644 --- a/src/leap/bitmask/services/eip/vpnlaunchers.py +++ b/src/leap/bitmask/services/eip/vpnlaunchers.py @@ -32,6 +32,7 @@ except ImportError: from abc import ABCMeta, abstractmethod from functools import partial +from time import sleep from leap.bitmask.config.leapsettings import LeapSettings @@ -228,7 +229,11 @@ def _try_to_launch_agent(standalone=False): env = { "PYTHONPATH": os.path.abspath('../../../../lib/')} try: - subprocess.call(["python", "-m", "leap.bitmask.util.polkit_agent"], + # We need to quote the command because subprocess call + # will do "sh -c 'foo'", so if we do not quoute it we'll end + # up with a invocation to the python interpreter. And that + # is bad. + subprocess.call(["python -m leap.bitmask.util.polkit_agent"], shell=True, env=env) except Exception as exc: logger.exception(exc) @@ -316,6 +321,7 @@ class LinuxVPNLauncher(VPNLauncher): if _is_pkexec_in_system(): if not _is_auth_agent_running(): _try_to_launch_agent(ProviderConfig.standalone) + sleep(0.5) if _is_auth_agent_running(): pkexec_possibilities = which(kls.PKEXEC_BIN) leap_assert(len(pkexec_possibilities) > 0, diff --git a/src/leap/bitmask/util/polkit_agent.py b/src/leap/bitmask/util/polkit_agent.py index a4650273..6fda2f88 100644 --- a/src/leap/bitmask/util/polkit_agent.py +++ b/src/leap/bitmask/util/polkit_agent.py @@ -24,24 +24,24 @@ import daemon logger = logging.getLogger(__name__) -BASE_PATH = "/usr/lib/policykit-1-gnome/"\ - + "polkit-%s-authentication-agent-1" - -GNOME_PATH = BASE_PATH % ("gnome",) -KDE_PATH = BASE_PATH % ("kde",) +AUTH_FILE = "polkit-%s-authentication-agent-1" +BASE_PATH_GNO = "/usr/lib/policykit-1-gnome/" +BASE_PATH_KDE = "/usr/lib/kde4/libexec/" +GNO_PATH = BASE_PATH_GNO + AUTH_FILE % ("gnome",) +KDE_PATH = BASE_PATH_KDE + AUTH_FILE % ("kde",) def _launch_agent(): logger.debug('Launching polkit auth agent') - print "launching polkit" try: - subprocess.call(GNOME_PATH) + subprocess.call(GNO_PATH) except Exception as exc: - try: - subprocess.call(KDE_PATH) - except Exception as exc: - logger.error('Exception while running polkit authentication agent ' - '%s' % (exc,)) + logger.error('Exception while running polkit authentication agent ' + '%s' % (exc,)) + # XXX fix KDE launch. See: #3755 + #try: + #subprocess.call(KDE_PATH) + #except Exception as exc: def launch(): |