From 2bf44a1d641c3bc35546cb49d3766f2962f9a984 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Thu, 29 Sep 2016 13:11:09 +0200 Subject: Explicitly handle all possible SecTrustResultType enum values Test-Information: Unit tests pass on macOS 10.12. Change-Id: I32f884e2525b6200e5fb3f04d58f77304d16daa0 diff --git a/Swiften/TLS/SecureTransport/SecureTransportContext.mm b/Swiften/TLS/SecureTransport/SecureTransportContext.mm index 970d270..1ed636b 100644 --- a/Swiften/TLS/SecureTransport/SecureTransportContext.mm +++ b/Swiften/TLS/SecureTransport/SecureTransportContext.mm @@ -262,11 +262,23 @@ void SecureTransportContext::verifyServerCertificate() { verificationError_ = std::make_shared(CertificateVerificationError::UnknownError); } break; - case kSecTrustResultOtherError: + case kSecTrustResultInvalid: verificationError_ = std::make_shared(CertificateVerificationError::UnknownError); break; - default: - SWIFT_LOG(warning) << "Unhandled trust result " << trustResult << "." << std::endl; + case kSecTrustResultConfirm: + // TODO: Confirmation from the user is required before proceeding. + verificationError_ = std::make_shared(CertificateVerificationError::UnknownError); + break; + case kSecTrustResultDeny: + // The user specified that the certificate should not be trusted. + verificationError_ = std::make_shared(CertificateVerificationError::Untrusted); + break; + case kSecTrustResultFatalTrustFailure: + // Trust denied; no simple fix is available. + verificationError_ = std::make_shared(CertificateVerificationError::UnknownError); + break; + case kSecTrustResultOtherError: + verificationError_ = std::make_shared(CertificateVerificationError::UnknownError); break; } -- cgit v0.10.2-6-g49f6