Эх сурвалжийг харах

Fix server trust nitpicks

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 жил өмнө
parent
commit
3ed1045347

+ 7 - 4
iOSClient/AppDelegate.swift

@@ -553,10 +553,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
     }
     
     func trustCertificateError(host: String) {
-        
-        guard let currentHost = URL(string: self.urlBase)?.host, let pushNotificationServerProxyHost = URL(string: NCBrandOptions.shared.pushNotificationServerProxy)?.host else { return }
-        if host == pushNotificationServerProxyHost || host != currentHost { return }
-        
+
+        guard let currentHost = URL(string: self.urlBase)?.host,
+              let pushNotificationServerProxyHost = URL(string: NCBrandOptions.shared.pushNotificationServerProxy)?.host,
+              host != pushNotificationServerProxyHost,
+              host == currentHost
+        else { return }
+
         let certificateHostSavedPath = CCUtility.getDirectoryCerificates()! + "/" + host + ".der"
         var title = NSLocalizedString("_ssl_certificate_changed_", comment: "")
         

+ 2 - 14
iOSClient/Networking/NCNetworking.swift

@@ -227,19 +227,7 @@ import Queuer
         if x509cert == nil {
             print("[LOG] OpenSSL couldn't parse X509 Certificate")
         } else {
-            
-            // save certificate
-//                if FileManager.default.fileExists(atPath: certNamePath) {
-//                    do {
-//                        try FileManager.default.removeItem(atPath: certNamePath)
-//                    } catch { }
-//                }
-//                let fileCert = fopen(certNamePath, "w")
-//                if fileCert != nil {
-//                    PEM_write_X509(fileCert, x509cert)
-//                }
-//                fclose(fileCert)
-            
+
             // save details
             if FileManager.default.fileExists(atPath: certNamePathTXT) {
                 do {
@@ -256,7 +244,7 @@ import Queuer
 
             X509_free(x509cert)
         }
-            
+
         BIO_free(mem)
     }