changeset 281:ef77423ce500

core: store tls_validation flag in host and use if for file upload.
author Goffi <goffi@goffi.org>
date Mon, 25 Mar 2019 07:11:09 +0100
parents b0461363bc65
children 1b835bcfa663
files android/sat.conf cagou/core/cagou_main.py cagou/plugins/plugin_wid_chat.py
diffstat 3 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/android/sat.conf	Wed Mar 20 09:29:44 2019 +0100
+++ b/android/sat.conf	Mon Mar 25 07:11:09 2019 +0100
@@ -4,5 +4,6 @@
 log_fmt = #[%%(levelname)s][%%(name)s] %%(message)s
 
 [cagou]
+no_certificate_validation = true
 log_level = debug
 log_fmt = [%%(levelname)s][%%(name)s] %%(message)s
--- a/cagou/core/cagou_main.py	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/core/cagou_main.py	Mon Mar 25 07:11:09 2019 +0100
@@ -429,10 +429,11 @@
         self._visible_widgets = {}  # visible widgets by classes
         self.version = C.APP_VERSION  # will be replaced by getVersion()
 
-        if C.bool(config.getConfig(main_config,
-                                   C.CONFIG_SECTION,
-                                   'no_certificate_validation',
-                                   C.BOOL_FALSE)):
+        self.tls_validation =  not C.bool(config.getConfig(main_config,
+                                                           C.CONFIG_SECTION,
+                                                           'no_certificate_validation',
+                                                           C.BOOL_FALSE))
+        if not self.tls_validation:
             from cagou.core import patches
             patches.apply()
             log.warning(u"SSL certificate validation is disabled, this is unsecure!")
--- a/cagou/plugins/plugin_wid_chat.py	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Mon Mar 25 07:11:09 2019 +0100
@@ -627,12 +627,13 @@
                 file_path,
                 "",
                 "",
-                {"ignore_tls_errors": C.BOOL_TRUE},  # FIXME: should not be the default
+                {"ignore_tls_errors": C.boolConst(not G.host.tls_validation)},
                 self.profile,
                 callback = partial(
                     G.host.actionManager,
                     progress_cb = partial(self.fileTransferCb, cleaning_cb=cleaning_cb),
-                    progress_eb = partial(self.fileTransferEb, cleaning_cb=cleaning_cb),               )
+                    progress_eb = partial(self.fileTransferEb, cleaning_cb=cleaning_cb),
+                    )
             )
         elif transfer_type == C.TRANSFER_SEND:
             if self.type == C.CHAT_GROUP: