summaryrefslogtreecommitdiff
path: root/src/leap/crypto
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@yahoo.com.ar>2013-07-05 16:01:45 -0300
committerIvan Alejandro <ivanalejandro0@yahoo.com.ar>2013-07-05 16:01:45 -0300
commit4480361f2fbdd293840f4eb1942c3edab2ff40c0 (patch)
treefa453b235ea38c8157e7e1ec4e61e3c000e196fb /src/leap/crypto
parent57184883c7aa30475d37681d6b88ff0c699e1c7b (diff)
parent17f608f0148c2340a811d6eb85bebd2e612f10be (diff)
Merge branch 'bug/handle_unreachable_provider' into develop
Diffstat (limited to 'src/leap/crypto')
-rw-r--r--src/leap/crypto/constants.py18
-rw-r--r--src/leap/crypto/srpauth.py10
-rw-r--r--src/leap/crypto/srpregister.py2
3 files changed, 8 insertions, 22 deletions
diff --git a/src/leap/crypto/constants.py b/src/leap/crypto/constants.py
deleted file mode 100644
index c5eaef1f..00000000
--- a/src/leap/crypto/constants.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- coding: utf-8 -*-
-# constants.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/>.
-
-SIGNUP_TIMEOUT = 5
diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py
index 0e95ae64..89fee80b 100644
--- a/src/leap/crypto/srpauth.py
+++ b/src/leap/crypto/srpauth.py
@@ -31,6 +31,7 @@ from twisted.internet import threads
from leap.common.check import leap_assert
from leap.util.request_helpers import get_content
+from leap.util.constants import REQUEST_TIMEOUT
from leap.common.events import signal as events_signal
from leap.common.events import events_pb2 as proto
@@ -155,7 +156,8 @@ class SRPAuth(QtCore.QObject):
init_session = self._session.post(sessions_url,
data=auth_data,
verify=self._provider_config.
- get_ca_cert_path())
+ get_ca_cert_path(),
+ timeout=REQUEST_TIMEOUT)
except requests.exceptions.ConnectionError as e:
logger.error("No connection made (salt): %r" %
(e,))
@@ -230,7 +232,8 @@ class SRPAuth(QtCore.QObject):
auth_result = self._session.put(auth_url,
data=auth_data,
verify=self._provider_config.
- get_ca_cert_path())
+ get_ca_cert_path(),
+ timeout=REQUEST_TIMEOUT)
except requests.exceptions.ConnectionError as e:
logger.error("No connection made (HAMK): %r" % (e,))
raise SRPAuthenticationError(self.tr("Could not connect to "
@@ -377,7 +380,8 @@ class SRPAuth(QtCore.QObject):
self._session.delete(logout_url,
data=self.get_session_id(),
verify=self._provider_config.
- get_ca_cert_path())
+ get_ca_cert_path(),
+ timeout=REQUEST_TIMEOUT)
except Exception as e:
logger.warning("Something went wrong with the logout: %r" %
(e,))
diff --git a/src/leap/crypto/srpregister.py b/src/leap/crypto/srpregister.py
index 07b3c917..42a2c4b0 100644
--- a/src/leap/crypto/srpregister.py
+++ b/src/leap/crypto/srpregister.py
@@ -25,7 +25,7 @@ from PySide import QtCore
from urlparse import urlparse
from leap.config.providerconfig import ProviderConfig
-from leap.crypto.constants import SIGNUP_TIMEOUT
+from leap.util.constants import SIGNUP_TIMEOUT
from leap.common.check import leap_assert, leap_assert_type
logger = logging.getLogger(__name__)