summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Crayne <jim.crayne@gmail.com>2015-06-18 18:08:47 -0400
committerJames Crayne <jim.crayne@gmail.com>2015-06-18 18:08:47 -0400
commit1edf4eafe890be20eb5b7416197a14f47b2baf0b (patch)
treeb068ea6073c3ef4c3bb1d78970fe0e56da24226f
parentc72a0a292d3b3e5b0c6d0c5cf395e658556eb4a2 (diff)
Fix to work with x509>=1.5, probably breaks 1.4
-rw-r--r--KeyRing.hs9
-rw-r--r--TimeUtil.hs1
-rw-r--r--kiki.cabal3
3 files changed, 11 insertions, 2 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index 857c755..2deb12b 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -145,8 +145,13 @@ import qualified Data.Text as T ( Text, unpack, pack,
145import qualified System.Posix.Types as Posix 145import qualified System.Posix.Types as Posix
146import System.Posix.Files ( modificationTime, getFileStatus, getFdStatus 146import System.Posix.Files ( modificationTime, getFileStatus, getFdStatus
147 , setFileCreationMask, setFileTimes ) 147 , setFileCreationMask, setFileTimes )
148#if MIN_VERSION_x509(1,5,0)
149import Data.Hourglass.Types
150import Data.Hourglass
151#endif
148#if MIN_VERSION_unix(2,7,0) 152#if MIN_VERSION_unix(2,7,0)
149import System.Posix.Files ( setFdTimesHiRes ) 153import System.Posix.Files ( setFdTimesHiRes )
154import Foreign.C.Types ( CTime(..), CLong, CInt(..) )
150#else 155#else
151import Foreign.C.Types ( CTime(..), CLong, CInt(..) ) 156import Foreign.C.Types ( CTime(..), CLong, CInt(..) )
152import Foreign.Marshal.Array ( withArray ) 157import Foreign.Marshal.Array ( withArray )
@@ -1472,7 +1477,9 @@ parseCertBlob comp bs = do
1472 let asn1' = drop 2 asn1 1477 let asn1' = drop 2 asn1
1473 cert <- either (const Nothing) (Just . fst) (fromASN1 asn1') 1478 cert <- either (const Nothing) (Just . fst) (fromASN1 asn1')
1474 let _ = cert :: X509.Certificate 1479 let _ = cert :: X509.Certificate
1475 (notBefore,_) = X509.certValidity cert 1480 notBefore :: UTCTime
1481 notBefore = toUTC ( timeFromElapsedP (timeGetElapsedP vincentTime) :: CTime) -- nanoToUTCTime nano
1482 where (vincentTime,_) = X509.certValidity cert
1476 case X509.certPubKey cert of 1483 case X509.certPubKey cert of
1477 X509.PubKeyRSA key -> do 1484 X509.PubKeyRSA key -> do
1478 let withoutkey = 1485 let withoutkey =
diff --git a/TimeUtil.hs b/TimeUtil.hs
index 9c0a2b5..9035e50 100644
--- a/TimeUtil.hs
+++ b/TimeUtil.hs
@@ -4,6 +4,7 @@ module TimeUtil
4 ( now 4 ( now
5 , IsTime(..) 5 , IsTime(..)
6 , fromTime 6 , fromTime
7 , toUTC
7 , parseRFC2822 8 , parseRFC2822
8 , printRFC2822 9 , printRFC2822
9 , dateParser 10 , dateParser
diff --git a/kiki.cabal b/kiki.cabal
index 944ae64..98a084b 100644
--- a/kiki.cabal
+++ b/kiki.cabal
@@ -22,7 +22,8 @@ Executable kiki
22 bytestring -any, openpgp (>=0.6.1), binary -any, 22 bytestring -any, openpgp (>=0.6.1), binary -any,
23 unix, time, 23 unix, time,
24 containers -any, process -any, filepath -any, 24 containers -any, process -any, filepath -any,
25 network -any, old-locale -any, zlib -any 25 network -any, old-locale -any, zlib -any,
26 hourglass -any
26 ghc-options: -O2 -fwarn-unused-binds -fwarn-unused-imports 27 ghc-options: -O2 -fwarn-unused-binds -fwarn-unused-imports
27 c-sources: dotlock.c 28 c-sources: dotlock.c
28 29