packages feed

x509-validation 1.5.1 → 1.5.2

raw patch · 2 files changed

+10/−7 lines, 2 files

Files

Data/X509/Validation.hs view
@@ -325,13 +325,16 @@                   unAltName _              = Nothing  -- | Validate that the fqhn is matched by at least one name in the certificate.--- The name can be either the common name or one of the alternative names if--- the SubjectAltName extension is present.+-- The name can be either one of the alternative names if the SubjectAltName+-- extension is present or the common name. validateCertificateName :: HostName -> Certificate -> [FailedReason]-validateCertificateName fqhn cert =-    case commonName of-        Nothing -> [NoCommonName]-        Just cn -> findMatch [] $ map (matchDomain . splitDot) (cn : altNames)+validateCertificateName fqhn cert+    | not $ null altNames =+        findMatch [] $ map (matchDomain . splitDot) altNames+    | otherwise =+        case commonName of+            Nothing -> [NoCommonName]+            Just cn -> findMatch [] $ [matchDomain $ splitDot $ cn]   where (commonName, altNames) = getNames cert          findMatch :: [FailedReason] -> [[FailedReason]] -> [FailedReason]
x509-validation.cabal view
@@ -1,5 +1,5 @@ Name:                x509-validation-Version:             1.5.1+Version:             1.5.2 Description:         X.509 Certificate and CRL validation License:             BSD3 License-file:        LICENSE