diff --git a/WireGuard/Shared/Keychain.swift b/WireGuard/Shared/Keychain.swift index edc546d..3059c57 100644 --- a/WireGuard/Shared/Keychain.swift +++ b/WireGuard/Shared/Keychain.swift @@ -112,6 +112,6 @@ class Keychain { static func verifyReference(called ref: Data) -> Bool { return SecItemCopyMatching([kSecClass as String: kSecClassGenericPassword, kSecValuePersistentRef as String: ref] as CFDictionary, - nil) == errSecSuccess + nil) != errSecItemNotFound } } diff --git a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift index ec1ea74..efee1e4 100644 --- a/WireGuard/WireGuard/Tunnel/TunnelsManager.swift +++ b/WireGuard/WireGuard/Tunnel/TunnelsManager.swift @@ -70,6 +70,7 @@ class TunnelsManager { if let ref = passwordRef { refs.insert(ref) } else { + wg_log(.info, message: "Removing orphaned tunnel with non-verifying keychain entry: \(tunnelManager.localizedDescription ?? "")") tunnelManager.removeFromPreferences { _ in } tunnelManagers.remove(at: index) }