diff options
-rw-r--r-- | changes/bug-2960_disable_keyring | 2 | ||||
-rw-r--r-- | changes/feature_openvpn_manifest | 2 | ||||
-rw-r--r-- | pkg/windows/openvpn_manifest | 19 | ||||
-rwxr-xr-x | setup.py | 47 | ||||
-rw-r--r-- | src/leap/gui/login.py | 4 | ||||
-rw-r--r-- | src/leap/gui/mainwindow.py | 7 | ||||
-rw-r--r-- | src/leap/gui/wizard.py | 8 | ||||
-rw-r--r-- | src/leap/util/keyring_helpers.py | 34 |
8 files changed, 87 insertions, 36 deletions
diff --git a/changes/bug-2960_disable_keyring b/changes/bug-2960_disable_keyring new file mode 100644 index 00000000..d1787c3c --- /dev/null +++ b/changes/bug-2960_disable_keyring @@ -0,0 +1,2 @@ + o Only use the Keyring with it's using a known good backend. Closes + #2960
\ No newline at end of file diff --git a/changes/feature_openvpn_manifest b/changes/feature_openvpn_manifest new file mode 100644 index 00000000..2b4454de --- /dev/null +++ b/changes/feature_openvpn_manifest @@ -0,0 +1,2 @@ + o Properly set the binary manifest to the windows openvpn + binary. Closes #203
\ No newline at end of file diff --git a/pkg/windows/openvpn_manifest b/pkg/windows/openvpn_manifest new file mode 100644 index 00000000..7c6a542a --- /dev/null +++ b/pkg/windows/openvpn_manifest @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <assemblyIdentity version="1.0.0.0" name="openvpn_leap" /> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> + <security> + <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + </requestedPrivileges> + <applicationRequestMinimum> + <defaultAssemblyRequest permissionSetReference="Custom" /> + <PermissionSet class="System.Security.PermissionSet" version="1" ID="Custom" SameSite="site" /> + </applicationRequestMinimum> + </security> + </trustInfo> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + </application> + </compatibility> +</asmv1:assembly>
\ No newline at end of file @@ -54,8 +54,6 @@ parsed_reqs = utils.parse_requirements() cmdclass = versioneer.get_cmdclass() leap_launcher = 'leap-client=leap.app:main' -from distutils.command.build import build as _build -from distutils.command.sdist import sdist as _sdist from setuptools.command.develop import develop as _develop @@ -66,27 +64,11 @@ def copy_reqs(path, withsrc=False): reqsfile = os.path.join(path, 'src', *_reqpath) else: reqsfile = os.path.join(path, *_reqpath) - print("UPDATING %s" % reqsfile) - if os.path.isfile(reqsfile): os.unlink(reqsfile) - f = open(reqsfile, "w") - f.write('\n'.join(parsed_reqs)) - f.close() - - -class cmd_build(_build): - def run(self): - # versioneer: - versions = versioneer.get_versions(verbose=True) - self._versioneer_generated_versions = versions - # unless we update this, the command will keep using the old version - self.distribution.metadata.version = versions["version"] - - _build.run(self) - copy_reqs(self.build_lib) - + with open(reqsfile, "w") as f: + f.write('\n'.join(parsed_reqs)) class cmd_develop(_develop): def run(self): @@ -99,24 +81,31 @@ class cmd_develop(_develop): _develop.run(self) copy_reqs(self.egg_path) +cmdclass["develop"] = cmd_develop -class cmd_sdist(_sdist): +# next two classes need to augment the versioneer modified ones + +versioneer_build = cmdclass['build'] +versioneer_sdist = cmdclass['sdist'] + + +class cmd_build(versioneer_build): def run(self): - # versioneer: - versions = versioneer.get_versions(verbose=True) - self._versioneer_generated_versions = versions - # unless we update this, the command will keep using the old version - self.distribution.metadata.version = versions["version"] - return _sdist.run(self) + versioneer_build.run(self) + copy_reqs(self.build_lib) + + +class cmd_sdist(versioneer_sdist): + def run(self): + return versioneer_sdist.run(self) def make_release_tree(self, base_dir, files): - _sdist.make_release_tree(self, base_dir, files) + versioneer_sdist.make_release_tree(self, base_dir, files) copy_reqs(base_dir, withsrc=True) cmdclass["build"] = cmd_build cmdclass["sdist"] = cmd_sdist -cmdclass["develop"] = cmd_develop setup( diff --git a/src/leap/gui/login.py b/src/leap/gui/login.py index c367b2fb..8fc6ec24 100644 --- a/src/leap/gui/login.py +++ b/src/leap/gui/login.py @@ -24,6 +24,8 @@ import keyring from PySide import QtCore, QtGui from ui_login import Ui_LoginWidget +from leap.util.keyring_helpers import has_keyring + logger = logging.getLogger(__name__) @@ -58,7 +60,7 @@ class LoginWidget(QtGui.QWidget): self.ui.chkRemember.stateChanged.connect( self._remember_state_changed) - self.ui.chkRemember.setEnabled(keyring.get_keyring() is not None) + self.ui.chkRemember.setEnabled(has_keyring()) self.ui.lnPassword.setEchoMode(QtGui.QLineEdit.Password) diff --git a/src/leap/gui/mainwindow.py b/src/leap/gui/mainwindow.py index 2ed01917..9dc1e006 100644 --- a/src/leap/gui/mainwindow.py +++ b/src/leap/gui/mainwindow.py @@ -55,6 +55,7 @@ from leap.services.eip.vpnlaunchers import (VPNLauncherException, EIPNoPkexecAvailable, EIPNoPolkitAuthAgentAvailable) from leap.util import __version__ as VERSION +from leap.util.keyring_helpers import has_keyring from leap.services.mail.smtpconfig import SMTPConfig @@ -435,7 +436,7 @@ class MainWindow(QtGui.QMainWindow): self._login_widget.set_user(possible_username) if possible_password is not None: self._login_widget.set_password(possible_password) - self._login_widget.set_remember(True) + self._login_widget.set_remember(has_keyring()) self._login() self._wizard = None self._settings.set_properprovider(True) @@ -454,7 +455,7 @@ class MainWindow(QtGui.QMainWindow): logger.error('Username@provider malformed. %r' % (e, )) saved_user = None - if saved_user is not None: + if saved_user is not None and has_keyring(): # fill the username self._login_widget.set_user(username) @@ -740,7 +741,7 @@ class MainWindow(QtGui.QMainWindow): self._login_widget.set_status(self.tr("Logging in..."), error=False) self._login_widget.set_enabled(False) - if self._login_widget.get_remember(): + if self._login_widget.get_remember() and has_keyring(): # in the keyring and in the settings # we store the value 'usename@provider' username_domain = (username + '@' + provider).encode("utf8") diff --git a/src/leap/gui/wizard.py b/src/leap/gui/wizard.py index 066a7db3..34eba84c 100644 --- a/src/leap/gui/wizard.py +++ b/src/leap/gui/wizard.py @@ -31,6 +31,7 @@ from leap.config.providerconfig import ProviderConfig from leap.crypto.srpregister import SRPRegister from leap.util.privilege_policies import is_missing_policy_permissions from leap.util.request_helpers import get_content +from leap.util.keyring_helpers import has_keyring from leap.services.eip.providerbootstrapper import ProviderBootstrapper from leap.services import get_available @@ -170,7 +171,7 @@ class Wizard(QtGui.QWizard): return self._password def get_remember(self): - return self.ui.chkRemember.isChecked() + return has_keyring() and self.ui.chkRemember.isChecked() def get_services(self): return self._selected_services @@ -286,8 +287,9 @@ class Wizard(QtGui.QWizard): self._set_registration_fields_visibility(False) # Allow the user to remember his password - self.ui.chkRemember.setVisible(True) - self.ui.chkRemember.setEnabled(True) + if has_keyring(): + self.ui.chkRemember.setVisible(True) + self.ui.chkRemember.setEnabled(True) self.page(self.REGISTER_USER_PAGE).set_completed() self.button(QtGui.QWizard.BackButton).setEnabled(False) diff --git a/src/leap/util/keyring_helpers.py b/src/leap/util/keyring_helpers.py new file mode 100644 index 00000000..b3dd0175 --- /dev/null +++ b/src/leap/util/keyring_helpers.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# privilege_policies.py +# Copyright (C) 2013 LEAP +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +""" + +""" + +import keyring + +OBSOLETE_KEYRINGS = [ + keyring.backends.file.EncryptedKeyring, + keyring.backends.file.PlaintextKeyring +] + +def has_keyring(): + """ + + """ + kr = keyring.get_keyring() + return kr is not None and kr.__class__ not in OBSOLETE_KEYRINGS |