Commit 2b65c5d5 authored by Yann Leboulanger's avatar Yann Leboulanger

ability to see certificate on ssl error dialog. Fixes #3998

parent 34248839
...@@ -1273,7 +1273,8 @@ def connection_accepted(self, con, con_type): ...@@ -1273,7 +1273,8 @@ def connection_accepted(self, con, con_type):
gajim.nec.push_incoming_event(SSLErrorEvent(None, conn=self, gajim.nec.push_incoming_event(SSLErrorEvent(None, conn=self,
error_text=text, error_num=errnum, error_text=text, error_num=errnum,
cert=con.Connection.ssl_cert_pem, 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 return True
if hasattr(con.Connection, 'ssl_fingerprint_sha1'): if hasattr(con.Connection, 'ssl_fingerprint_sha1'):
saved_fingerprint = gajim.config.get_per('accounts', self.name, 'ssl_fingerprint_sha1') saved_fingerprint = gajim.config.get_per('accounts', self.name, 'ssl_fingerprint_sha1')
......
...@@ -5646,11 +5646,28 @@ def __init__(self, pritext='', sectext='', checktext='', ...@@ -5646,11 +5646,28 @@ def __init__(self, pritext='', sectext='', checktext='',
self.cert = certificate self.cert = certificate
YesNoDialog.__init__(self, pritext, sectext, checktext, on_response_yes, YesNoDialog.__init__(self, pritext, sectext, checktext, on_response_yes,
on_response_no) on_response_no)
b = gtk.Button('View cert...') b = gtk.Button(_('View cert...'))
b.connect('clicked', self.on_cert_clicked) b.connect('clicked', self.on_cert_clicked)
b.show_all() b.show_all()
area = self.get_action_area() area = self.get_action_area()
area.pack_start(b) area.pack_start(b)
def on_cert_clicked(self, button): def on_cert_clicked(self, button):
d = CertificatDialog(self, self.account, self.cert) d = CertificatDialog(self, self.account, self.cert)
\ No newline at end of file
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)
...@@ -1219,8 +1219,9 @@ def on_cancel(): ...@@ -1219,8 +1219,9 @@ def on_cancel():
if 'ssl_error' in self.instances[account]['online_dialog']: if 'ssl_error' in self.instances[account]['online_dialog']:
self.instances[account]['online_dialog']['ssl_error'].destroy() self.instances[account]['online_dialog']['ssl_error'].destroy()
self.instances[account]['online_dialog']['ssl_error'] = \ self.instances[account]['online_dialog']['ssl_error'] = \
dialogs.ConfirmationDialogDoubleCheck(pritext, sectext, checktext1, dialogs.SSLErrorDialog(obj.conn.name, obj.certificate, pritext,
checktext2, on_response_ok=on_ok, on_response_cancel=on_cancel) sectext, checktext1, checktext2, on_response_ok=on_ok,
on_response_cancel=on_cancel)
def handle_event_fingerprint_error(self, obj): def handle_event_fingerprint_error(self, obj):
# ('FINGERPRINT_ERROR', account, (new_fingerprint,)) # ('FINGERPRINT_ERROR', account, (new_fingerprint,))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment