summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-06-02 18:39:38 (GMT)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>2009-06-02 18:39:38 (GMT)
commit1f623271ad88a07a774b2c42c4bbc11f0b7fc0e6 (patch)
treebab508648873b05b7cd3e72c812c7da1682a660d
parent267e968bc80a18a60ff34df4f2ea808631eae0ed (diff)
downloadgtimelog-1f623271ad88a07a774b2c42c4bbc11f0b7fc0e6.tar.gz
gtimelog-1f623271ad88a07a774b2c42c4bbc11f0b7fc0e6.tar.xz
Verify that the provided certificate file exist and error out if not
It is a more useful error message than the resulting "Certificate verification failed"
-rwxr-xr-xsrc/gtimelog/gtimelog.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gtimelog/gtimelog.py b/src/gtimelog/gtimelog.py
index 810dd11..946f7d8 100755
--- a/src/gtimelog/gtimelog.py
+++ b/src/gtimelog/gtimelog.py
@@ -887,6 +887,11 @@ class RemoteTaskList(TaskList):
ctx = SSL.Context()
ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, 9)
+
+ if not os.path.exists(self.settings.server_cert):
+ self.error_callback("Certificate file not found")
+ return
+
ctx.load_verify_locations(self.settings.server_cert)
passmgr = GtkPasswordRequest ()
@@ -2034,6 +2039,11 @@ class SubmitWindow(object):
ctx = SSL.Context()
ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, 9)
+
+ if not os.path.exists(self.settings.server_cert):
+ self.error_dialog("Provided certificate %s not found" % self.settings.server_cert)
+ return
+
ctx.load_verify_locations(self.settings.server_cert)
passmgr = GtkPasswordRequest ()