summaryrefslogtreecommitdiff
path: root/src/leap/services/eip/vpnlaunchers.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/services/eip/vpnlaunchers.py')
-rw-r--r--src/leap/services/eip/vpnlaunchers.py51
1 files changed, 5 insertions, 46 deletions
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index c646da7d..f9e8e366 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -18,18 +18,19 @@
"""
Platform dependant VPN launchers
"""
-import os
-import platform
-import logging
import commands
+import logging
import getpass
import grp
+import os
+import platform
from abc import ABCMeta, abstractmethod
+from leap.common.check import leap_assert, leap_assert_type
+from leap.common.files import which
from leap.config.providerconfig import ProviderConfig
from leap.services.eip.eipconfig import EIPConfig
-from leap.util.check import leap_assert, leap_assert_type
logger = logging.getLogger(__name__)
@@ -86,48 +87,6 @@ def get_platform_launcher():
return launcher()
-# Twisted implementation of which
-def which(name, flags=os.X_OK, path_extension="/usr/sbin:/sbin"):
- """
- Search PATH for executable files with the given name.
-
- On newer versions of MS-Windows, the PATHEXT environment variable will be
- set to the list of file extensions for files considered executable. This
- will normally include things like ".EXE". This fuction will also find files
- with the given name ending with any of these extensions.
-
- On MS-Windows the only flag that has any meaning is os.F_OK. Any other
- flags will be ignored.
-
- @type name: C{str}
- @param name: The name for which to search.
-
- @type flags: C{int}
- @param flags: Arguments to L{os.access}.
-
- @rtype: C{list}
- @param: A list of the full paths to files found, in the
- order in which they were found.
- """
-
- result = []
- exts = filter(None, os.environ.get('PATHEXT', '').split(os.pathsep))
- path = os.environ.get('PATH', None)
- path += ":" + path_extension
- if path is None:
- return []
- parts = path.split(os.pathsep)
- for p in parts:
- p = os.path.join(p, name)
- if os.access(p, flags):
- result.append(p)
- for e in exts:
- pext = p + e
- if os.access(pext, flags):
- result.append(pext)
- return result
-
-
def _is_pkexec_in_system():
pkexec_path = which('pkexec')
if len(pkexec_path) == 0: