summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2019-04-01 14:56:36 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2019-04-01 14:56:36 +0100
commitda23aa26c5958fcb243a6ab1a21d18ba2247c0cb (patch)
tree34c3d7629229e05af301a551a98cb904cd2fce3f /synapse
parentpunctuation (diff)
downloadsynapse-da23aa26c5958fcb243a6ab1a21d18ba2247c0cb.tar.xz
Cleaner code logic
Diffstat (limited to 'synapse')
-rw-r--r--synapse/crypto/context_factory.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/crypto/context_factory.py b/synapse/crypto/context_factory.py
index 7f747cd55a..2c2bfa3a89 100644
--- a/synapse/crypto/context_factory.py
+++ b/synapse/crypto/context_factory.py
@@ -138,12 +138,10 @@ class ClientTLSOptionsFactory(object):
         # Use _makeContext so that we get a fresh OpenSSL CTX each time.
 
         # Check if certificate validation has been enabled
-        if config.federation_verify_certificates:
-            # Check if this host is whitelisted
-            if host in config.federation_certificate_validation_whitelist:
-                return ClientTLSOptions(host, self._options_novalidate._makeContext())
-
-            # Otherwise require validation
+        if (config.federation_verify_certificates and
+                host not in config.federation_certificate_validation_whitelist):
+            # Require validation
             return ClientTLSOptions(host, self._options_validate._makeContext())
 
+        # Otherwise don't require validation
         return ClientTLSOptions(host, self._options_novalidate._makeContext())