Hello community, here is the log from the commit of package ghc-x509-system for openSUSE:Factory checked in at 2015-12-23 08:50:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-x509-system (Old) and /work/SRC/openSUSE:Factory/.ghc-x509-system.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-x509-system" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-x509-system/ghc-x509-system.changes 2015-09-17 09:19:49.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-x509-system.new/ghc-x509-system.changes 2015-12-23 08:50:16.000000000 +0100 @@ -1,0 +2,5 @@ +Mon Dec 21 08:11:02 UTC 2015 - [email protected] + +- update to 1.6.3 + +------------------------------------------------------------------- Old: ---- x509-system-1.6.1.tar.gz New: ---- x509-system-1.6.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-x509-system.spec ++++++ --- /var/tmp/diff_new_pack.2M18CJ/_old 2015-12-23 08:50:17.000000000 +0100 +++ /var/tmp/diff_new_pack.2M18CJ/_new 2015-12-23 08:50:17.000000000 +0100 @@ -19,7 +19,7 @@ %global pkg_name x509-system Name: ghc-x509-system -Version: 1.6.1 +Version: 1.6.3 Release: 0 Summary: Handle per-operating-system X.509 accessors and storage License: BSD-3-Clause ++++++ x509-system-1.6.1.tar.gz -> x509-system-1.6.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/x509-system-1.6.1/System/X509/Unix.hs new/x509-system-1.6.3/System/X509/Unix.hs --- old/x509-system-1.6.1/System/X509/Unix.hs 2015-09-07 14:46:45.000000000 +0200 +++ new/x509-system-1.6.3/System/X509/Unix.hs 2015-12-19 09:08:49.000000000 +0100 @@ -32,6 +32,8 @@ import qualified Control.Exception as E import Data.Char +import Data.Maybe (catMaybes) +import Data.Monoid (mconcat) defaultSystemPaths :: [FilePath] defaultSystemPaths = @@ -44,33 +46,41 @@ envPathOverride :: String envPathOverride = "SYSTEM_CERTIFICATE_PATH" -listDirectoryCerts :: FilePath -> IO (Maybe [FilePath]) -listDirectoryCerts path = do +-- List all the path susceptible to contains a certificate in a directory +-- +-- if the parameter is not a directory, hilarity follows. +listDirectoryCerts :: FilePath -> IO [FilePath] +listDirectoryCerts path = + getDirContents >>= filterM doesFileExist + where + isHashedFile s = length s == 10 + && isDigit (s !! 9) + && (s !! 8) == '.' + && all isHexDigit (take 8 s) + isCert x = (not $ isPrefixOf "." x) && (not $ isHashedFile x) + + getDirContents = E.catch (map (path </>) . filter isCert <$> getDirectoryContents path) emptyPaths + where emptyPaths :: E.IOException -> IO [FilePath] + emptyPaths _ = return [] + +makeCertStore :: FilePath -> IO (Maybe CertificateStore) +makeCertStore path = do isDir <- doesDirectoryExist path isFile <- doesFileExist path - if isDir - then (fmap (map (path </>) . filter isCert) <$> getDirContents) - >>= maybe (return Nothing) (\l -> Just <$> filterM doesFileExist l) - else if isFile then return $ Just [path] else return Nothing - where isHashedFile s = length s == 10 - && isDigit (s !! 9) - && (s !! 8) == '.' - && all isHexDigit (take 8 s) - isCert x = (not $ isPrefixOf "." x) && (not $ isHashedFile x) - - getDirContents = E.catch (Just <$> getDirectoryContents path) emptyPaths - where emptyPaths :: E.IOException -> IO (Maybe [FilePath]) - emptyPaths _ = return Nothing + wrapStore <$> (if isDir then makeDirStore else if isFile then makeFileStore else return []) + where + wrapStore :: [SignedCertificate] -> Maybe CertificateStore + wrapStore [] = Nothing + wrapStore l = Just $ makeCertificateStore l + + makeFileStore = readCertificates path + makeDirStore = do + certFiles <- listDirectoryCerts path + concat <$> mapM readCertificates certFiles + getSystemCertificateStore :: IO CertificateStore -getSystemCertificateStore = makeCertificateStore <$> (getSystemPaths >>= findFirst) - where findFirst [] = return [] - findFirst (p:ps) = do - r <- listDirectoryCerts p - case r of - Nothing -> findFirst ps - Just [] -> findFirst ps - Just files -> concat <$> mapM readCertificates files +getSystemCertificateStore = mconcat . catMaybes <$> (getSystemPaths >>= mapM makeCertStore) getSystemPaths :: IO [FilePath] getSystemPaths = E.catch ((:[]) <$> getEnv envPathOverride) inDefault @@ -78,6 +88,9 @@ inDefault :: E.IOException -> IO [FilePath] inDefault _ = return defaultSystemPaths +-- Try to read certificate from the content of a file. +-- +-- The file may contains multiple certificates readCertificates :: FilePath -> IO [SignedCertificate] readCertificates file = E.catch (either (const []) (rights . map getCert) . pemParseBS <$> B.readFile file) skipIOError where diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/x509-system-1.6.1/x509-system.cabal new/x509-system-1.6.3/x509-system.cabal --- old/x509-system-1.6.1/x509-system.cabal 2015-09-07 14:46:45.000000000 +0200 +++ new/x509-system-1.6.3/x509-system.cabal 2015-12-19 09:08:49.000000000 +0100 @@ -1,5 +1,5 @@ Name: x509-system -Version: 1.6.1 +Version: 1.6.3 Description: System X.509 handling License: BSD3 License-file: LICENSE
