summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services
diff options
context:
space:
mode:
authorTomás Touceda <chiiph@leap.se>2013-10-29 13:03:53 -0300
committerTomás Touceda <chiiph@leap.se>2013-10-29 13:03:53 -0300
commitdba45ace351caa4c097f1ee1498e164cf4683a4f (patch)
tree7269328783217abe12cd9e730fa4e564a13c5521 /src/leap/bitmask/services
parent49db36a361a6fe027f2fffacf52d715b11cbdb52 (diff)
parentc90be9157d5423d055984b354c5712f6873336b8 (diff)
Merge remote-tracking branch 'ivan/bug/4189_fix-non-ascii-path-problem' into develop
Diffstat (limited to 'src/leap/bitmask/services')
-rw-r--r--src/leap/bitmask/services/__init__.py7
-rw-r--r--src/leap/bitmask/services/eip/darwinvpnlauncher.py5
-rw-r--r--src/leap/bitmask/services/eip/linuxvpnlauncher.py5
-rw-r--r--src/leap/bitmask/services/eip/vpnlauncher.py3
-rw-r--r--src/leap/bitmask/services/eip/vpnprocess.py18
-rw-r--r--src/leap/bitmask/services/soledad/soledadbootstrapper.py14
6 files changed, 37 insertions, 15 deletions
diff --git a/src/leap/bitmask/services/__init__.py b/src/leap/bitmask/services/__init__.py
index f9456159..e62277b6 100644
--- a/src/leap/bitmask/services/__init__.py
+++ b/src/leap/bitmask/services/__init__.py
@@ -19,6 +19,7 @@ Services module.
"""
import logging
import os
+import sys
from PySide import QtCore
@@ -135,8 +136,12 @@ def download_service_config(provider_config, service_config,
if token is not None:
headers["Authorization"] = 'Token token="{0}"'.format(token)
+ verify = provider_config.get_ca_cert_path()
+ if verify:
+ verify = verify.encode(sys.getfilesystemencoding())
+
res = session.get(config_uri,
- verify=provider_config.get_ca_cert_path(),
+ verify=verify,
headers=headers,
timeout=REQUEST_TIMEOUT,
cookies=cookies)
diff --git a/src/leap/bitmask/services/eip/darwinvpnlauncher.py b/src/leap/bitmask/services/eip/darwinvpnlauncher.py
index f3b6bfc8..fe3fe4c1 100644
--- a/src/leap/bitmask/services/eip/darwinvpnlauncher.py
+++ b/src/leap/bitmask/services/eip/darwinvpnlauncher.py
@@ -21,6 +21,7 @@ import commands
import getpass
import logging
import os
+import sys
from leap.bitmask.services.eip.vpnlauncher import VPNLauncher
from leap.bitmask.services.eip.vpnlauncher import VPNLauncherException
@@ -185,6 +186,8 @@ class DarwinVPNLauncher(VPNLauncher):
:rtype: dict
"""
+ ld_library_path = os.path.join(get_path_prefix(), "..", "lib")
+ ld_library_path.encode(sys.getfilesystemencoding())
return {
- "DYLD_LIBRARY_PATH": os.path.join(get_path_prefix(), "..", "lib")
+ "DYLD_LIBRARY_PATH": ld_library_path
}
diff --git a/src/leap/bitmask/services/eip/linuxvpnlauncher.py b/src/leap/bitmask/services/eip/linuxvpnlauncher.py
index efb23285..d02f6f96 100644
--- a/src/leap/bitmask/services/eip/linuxvpnlauncher.py
+++ b/src/leap/bitmask/services/eip/linuxvpnlauncher.py
@@ -21,6 +21,7 @@ import commands
import logging
import os
import subprocess
+import sys
import time
from leap.bitmask.config import flags
@@ -231,6 +232,8 @@ class LinuxVPNLauncher(VPNLauncher):
:rtype: dict
"""
+ ld_library_path = os.path.join(get_path_prefix(), "..", "lib")
+ ld_library_path.encode(sys.getfilesystemencoding())
return {
- "LD_LIBRARY_PATH": os.path.join(get_path_prefix(), "..", "lib")
+ "LD_LIBRARY_PATH": ld_library_path
}
diff --git a/src/leap/bitmask/services/eip/vpnlauncher.py b/src/leap/bitmask/services/eip/vpnlauncher.py
index bce3599b..07497814 100644
--- a/src/leap/bitmask/services/eip/vpnlauncher.py
+++ b/src/leap/bitmask/services/eip/vpnlauncher.py
@@ -250,9 +250,6 @@ class VPNLauncher(object):
'--ping-restart', '30']
command_and_args = [openvpn] + args
- logger.debug("Running VPN with command:")
- logger.debug(" ".join(command_and_args))
-
return command_and_args
@classmethod
diff --git a/src/leap/bitmask/services/eip/vpnprocess.py b/src/leap/bitmask/services/eip/vpnprocess.py
index 19e1aa7b..51f0f738 100644
--- a/src/leap/bitmask/services/eip/vpnprocess.py
+++ b/src/leap/bitmask/services/eip/vpnprocess.py
@@ -23,6 +23,7 @@ import psutil
import psutil.error
import shutil
import socket
+import sys
from itertools import chain, repeat
@@ -864,15 +865,26 @@ class VPNProcess(protocol.ProcessProtocol, VPNManager):
"""
Gets the vpn command from the aproppriate launcher.
- Might throw: VPNLauncherException, OpenVPNNotFoundException.
+ Might throw:
+ VPNLauncherException,
+ OpenVPNNotFoundException.
+
+ :rtype: list of str
"""
- cmd = self._launcher.get_vpn_command(
+ command = self._launcher.get_vpn_command(
eipconfig=self._eipconfig,
providerconfig=self._providerconfig,
socket_host=self._socket_host,
socket_port=self._socket_port,
openvpn_verb=self._openvpn_verb)
- return map(str, cmd)
+
+ encoding = sys.getfilesystemencoding()
+ for i, c in enumerate(command):
+ if not isinstance(c, str):
+ command[i] = c.encode(encoding)
+
+ logger.debug("Running VPN with command: {0}".format(command))
+ return command
# shutdown
diff --git a/src/leap/bitmask/services/soledad/soledadbootstrapper.py b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
index 1940fc68..fec60338 100644
--- a/src/leap/bitmask/services/soledad/soledadbootstrapper.py
+++ b/src/leap/bitmask/services/soledad/soledadbootstrapper.py
@@ -20,6 +20,7 @@ Soledad bootstrapping
import logging
import os
import socket
+import sys
from ssl import SSLError
@@ -241,14 +242,15 @@ class SoledadBootstrapper(AbstractBootstrapper):
"""
# TODO: If selected server fails, retry with another host
# (issue #3309)
+ encoding = sys.getfilesystemencoding()
try:
self._soledad = Soledad(
uuid,
- self._password.encode("utf-8"),
- secrets_path=secrets_path,
- local_db_path=local_db_path,
+ self._password.encode('utf-8'),
+ secrets_path=secrets_path.encode(encoding),
+ local_db_path=local_db_path.encode(encoding),
server_url=server_url,
- cert_file=cert_file,
+ cert_file=cert_file.encode(encoding),
auth_token=auth_token)
# XXX All these errors should be handled by soledad itself,
@@ -414,9 +416,9 @@ class SoledadBootstrapper(AbstractBootstrapper):
:param provider_config: Provider configuration
:type provider_config: ProviderConfig
:param user: User's login
- :type user: str
+ :type user: unicode
:param password: User's password
- :type password: str
+ :type password: unicode
:param download_if_needed: If True, it will only download
files if the have changed since the
time it was previously downloaded.