Changeset 9886

Show
Ignore:
Timestamp:
07/05/08 20:07:32 (5 months ago)
Author:
asterix
Message:

warn before connecting without PyOpenSSL. fixes #4065

Location:
trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/config.py

    r9815 r9886  
    278278                        'keyname': [ opt_str, '', '', True ], 
    279279                        'connection_types': [ opt_str, 'tls ssl plain', _('Ordered list (space separated) of connection type to try. Can contain tls, ssl or plain')], 
    280                         'warn_when_insecure_connection': [ opt_bool, True, _('Show a warning dialog before sending password on an insecure connection.') ], 
     280                        'warn_when_plaintext_connection': [ opt_bool, True, _('Show a warning dialog before sending password on an plaintext connection.') ], 
     281                        'warn_when_insecure_ssl_connection': [ opt_bool, True, _('Show a warning dialog before using standard SSL library.') ], 
    281282                        'ssl_fingerprint_sha1': [ opt_str, '', '', True ], 
    282283                        'ignore_ssl_errors': [ opt_str, '', _('Space separated list of ssl errors to ignore.') ], 
  • trunk/src/common/connection.py

    r9876 r9886  
    615615                        return 
    616616                if _con_type == 'plain' and gajim.config.get_per('accounts', self.name, 
    617                 'warn_when_insecure_connection'): 
     617                'warn_when_plaintext_connection'): 
    618618                        self.dispatch('PLAIN_CONNECTION', (con,)) 
     619                        return True 
     620                if _con_type in ('tls', 'ssl') and not hasattr(con.Connection, 
     621                '_sslcontext') and gajim.config.get_per('accounts', self.name, 
     622                'warn_when_insecure_ssl_connection'): 
     623                        # Pyopenssl is not used 
     624                        self.dispatch('INSECURE_SSL_CONNECTION', (con, _con_type)) 
    619625                        return True 
    620626                return self.connection_accepted(con, con_type) 
  • trunk/src/config.py

    r9744 r9886  
    15671567                self.xml.get_widget('proxy_hbox1').set_sensitive(not use_env_http_proxy) 
    15681568 
    1569                 warn_when_insecure = gajim.config.get_per('accounts', account, 
    1570                         'warn_when_insecure_connection') 
     1569                warn_when_insecure_ssl = gajim.config.get_per('accounts', account, 
     1570                        'warn_when_insecure_ssl_connection') 
    15711571                self.xml.get_widget('warn_when_insecure_connection_checkbutton1').\ 
    1572                         set_active(warn_when_insecure) 
     1572                        set_active(warn_when_insecure_ssl) 
    15731573 
    15741574                self.xml.get_widget('send_keepalive_checkbutton1').set_active( 
     
    19401940                        return 
    19411941 
    1942                 self.on_checkbutton_toggled(widget, 'warn_when_insecure_connection', 
     1942                self.on_checkbutton_toggled(widget, 'warn_when_insecure_ssl_connection', 
    19431943                        account=self.current_account) 
    19441944 
  • trunk/src/gajim.py

    r9880 r9886  
    19341934                # ('PLAIN_CONNECTION', account, (connection)) 
    19351935                server = gajim.config.get_per('accounts', account, 'hostname') 
    1936                 def on_yes(is_checked): 
    1937                         if is_checked: 
     1936                def on_ok(is_checked): 
     1937                        if not is_checked[0]: 
     1938                                on_cancel() 
     1939                                return 
     1940                        if is_checked[1]: 
    19381941                                gajim.config.set_per('accounts', account, 
    1939                                         'warn_when_insecure_connection', False) 
     1942                                        'warn_when_plaintext_connection', False) 
    19401943                        gajim.connections[account].connection_accepted(data[0], 'tcp') 
    1941                 def on_no(): 
     1944                def on_cancel(): 
     1945                        gajim.connections[account].disconnect(on_purpose=True) 
     1946                        self.handle_event_status(account, 'offline') 
     1947                pritext = _('Insecure connection') 
     1948                sectext = _('You are about to send your password on an unencrypted ' 
     1949                        'connection. Are you sure you want to do that?') 
     1950                checktext1 = _('Yes, I really want to connect insecurely') 
     1951                checktext2 = _('Do _not ask me again') 
     1952                dialog = dialogs.ConfirmationDialogDubbleCheck(pritext, sectext, 
     1953                        checktext1, checktext2, on_response_ok=on_ok, 
     1954                        on_response_cancel=on_cancel, is_modal=False) 
     1955 
     1956        def handle_event_insecure_ssl_connection(self, account, data): 
     1957                # ('INSECURE_SSL_CONNECTION', account, (connection, connection_type)) 
     1958                server = gajim.config.get_per('accounts', account, 'hostname') 
     1959                def on_ok(is_checked): 
     1960                        if not is_checked[0]: 
     1961                                on_cancel() 
     1962                                return 
     1963                        if is_checked[1]: 
     1964                                gajim.config.set_per('accounts', account, 
     1965                                        'warn_when_insecure_ssl_connection', False) 
     1966                        gajim.connections[account].connection_accepted(data[0], data[1]) 
     1967                def on_cancel(): 
    19421968                        gajim.connections[account].disconnect(on_purpose=True) 
    19431969                        self.handle_event_status(account, 'offline') 
    19441970                pritext = _('Insecure connection') 
    19451971                sectext = _('You are about to send your password on an insecure ' 
    1946                         'connection. Are you sure you want to do that?') 
    1947                 checktext = _('Do _not ask me again') 
    1948                 dialog = dialogs.YesNoDialog(pritext, sectext, checktext, 
    1949                         on_response_yes=on_yes, on_response_no=on_no) 
     1972                        'connection. You should install PyOpenSSL to prevent that. Are you sure you want to do that?') 
     1973                checktext1 = _('Yes, I really want to connect insecurely') 
     1974                checktext2 = _('Do _not ask me again') 
     1975                dialog = dialogs.ConfirmationDialogDubbleCheck(pritext, sectext, 
     1976                        checktext1, checktext2, on_response_ok=on_ok, 
     1977                        on_response_cancel=on_cancel, is_modal=False) 
    19501978 
    19511979        def handle_event_pubsub_node_removed(self, account, data): 
     
    20382066                        'FINGERPRINT_ERROR': self.handle_event_fingerprint_error, 
    20392067                        'PLAIN_CONNECTION': self.handle_event_plain_connection, 
     2068                        'INSECURE_SSL_CONNECTION': self.handle_event_insecure_ssl_connection, 
    20402069                        'PUBSUB_NODE_REMOVED': self.handle_event_pubsub_node_removed, 
    20412070                        'PUBSUB_NODE_NOT_REMOVED': self.handle_event_pubsub_node_not_removed,