summaryrefslogtreecommitdiff
path: root/src/leap/crypto
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-05-29 04:02:43 +0900
committerkali <kali@leap.se>2013-05-30 02:57:20 +0900
commit884d0e0f4dbba34b6f6f5afe6e27390a7606a7fa (patch)
tree7abe4115eab8959b191a64706743df70dff92a79 /src/leap/crypto
parentc4ba840c7c0df81fa928bab2edd1f2a2e3379952 (diff)
make tests pass & fix pep8
Diffstat (limited to 'src/leap/crypto')
-rw-r--r--src/leap/crypto/srpauth.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/leap/crypto/srpauth.py b/src/leap/crypto/srpauth.py
index 2f3cbd1c..f1897e1d 100644
--- a/src/leap/crypto/srpauth.py
+++ b/src/leap/crypto/srpauth.py
@@ -22,6 +22,9 @@ import requests
import srp
import json
+#this error is raised from requests
+from simplejson.decoder import JSONDecodeError
+
from PySide import QtCore, QtGui
from leap.common.check import leap_assert
@@ -232,7 +235,10 @@ class SRPAuth(QtCore.QObject):
raise SRPAuthenticationError(self.tr("Could not connect to "
"the server"))
- content, mtime = get_content(auth_result)
+ try:
+ content, mtime = get_content(auth_result)
+ except JSONDecodeError:
+ raise SRPAuthenticationError("Bad JSON content in auth result")
if auth_result.status_code == 422:
logger.error("[%s] Wrong password (HAMK): [%s]" %
@@ -319,6 +325,7 @@ class SRPAuth(QtCore.QObject):
self._authentication_preprocessing(username, password)
salt, B = self._start_authentication(username, password)
M2 = self._process_challenge(salt, B, username)
+
self._verify_session(M2)
leap_assert(self.get_session_id(), "Something went wrong because"