From 2b65c5d5a56da66d9c0284f1827a643fd507e296 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 18 Apr 2011 22:50:39 +0200 Subject: [PATCH] ability to see certificate on ssl error dialog. Fixes #3998 --- src/common/connection.py | 3 ++- src/dialogs.py | 21 +++++++++++++++++++-- src/gui_interface.py | 5 +++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index be74de6f6..f13cf8ada 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1273,7 +1273,8 @@ class Connection(CommonConnection, ConnectionHandlers): gajim.nec.push_incoming_event(SSLErrorEvent(None, conn=self, error_text=text, error_num=errnum, cert=con.Connection.ssl_cert_pem, - fingerprint=con.Connection.ssl_fingerprint_sha1)) + fingerprint=con.Connection.ssl_fingerprint_sha1, + certificate=con.Connection.ssl_certificate)) return True if hasattr(con.Connection, 'ssl_fingerprint_sha1'): saved_fingerprint = gajim.config.get_per('accounts', self.name, 'ssl_fingerprint_sha1') diff --git a/src/dialogs.py b/src/dialogs.py index 982c55c17..725a36297 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -5646,11 +5646,28 @@ class CheckFingerprintDialog(YesNoDialog): self.cert = certificate YesNoDialog.__init__(self, pritext, sectext, checktext, on_response_yes, on_response_no) - b = gtk.Button('View cert...') + b = gtk.Button(_('View cert...')) b.connect('clicked', self.on_cert_clicked) b.show_all() area = self.get_action_area() area.pack_start(b) def on_cert_clicked(self, button): - d = CertificatDialog(self, self.account, self.cert) \ No newline at end of file + d = CertificatDialog(self, self.account, self.cert) + +class SSLErrorDialog(ConfirmationDialogDoubleCheck): + def __init__(self, account, certificate, pritext, sectext, checktext1, + checktext2, on_response_ok=None, on_response_cancel=None): + self.account = account + self.cert = certificate + ConfirmationDialogDoubleCheck.__init__(self, pritext, sectext, + checktext1, checktext2, on_response_ok, on_response_cancel, + is_modal=False) + b = gtk.Button(_('View cert...')) + b.connect('clicked', self.on_cert_clicked) + b.show_all() + area = self.get_action_area() + area.pack_start(b) + + def on_cert_clicked(self, button): + d = CertificatDialog(self, self.account, self.cert) diff --git a/src/gui_interface.py b/src/gui_interface.py index a5c1a5366..09236cbaf 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -1219,8 +1219,9 @@ class Interface: if 'ssl_error' in self.instances[account]['online_dialog']: self.instances[account]['online_dialog']['ssl_error'].destroy() self.instances[account]['online_dialog']['ssl_error'] = \ - dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1, - checktext2, on_response_ok=on_ok, on_response_cancel=on_cancel) + dialogs.SSLErrorDialog(obj.conn.name, obj.certificate, pritext, + sectext, checktext1, checktext2, on_response_ok=on_ok, + on_response_cancel=on_cancel) def handle_event_fingerprint_error(self, obj): # ('FINGERPRINT_ERROR', account, (new_fingerprint,))