diff options
Diffstat (limited to 'KeyRing.hs')
-rw-r--r-- | KeyRing.hs | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -133,7 +133,6 @@ import Foreign.Storable | |||
133 | #endif | 133 | #endif |
134 | import System.FilePath ( takeDirectory ) | 134 | import System.FilePath ( takeDirectory ) |
135 | import System.IO (hPutStrLn,withFile,IOMode(..), Handle, hPutStr) | 135 | import System.IO (hPutStrLn,withFile,IOMode(..), Handle, hPutStr) |
136 | import Foreign.C.Types ( CTime ) | ||
137 | import Data.IORef | 136 | import Data.IORef |
138 | import System.Posix.IO ( fdToHandle ) | 137 | import System.Posix.IO ( fdToHandle ) |
139 | import qualified Data.Traversable as Traversable ( mapM ) | 138 | import qualified Data.Traversable as Traversable ( mapM ) |
@@ -550,10 +549,12 @@ instance Applicative KikiCondition where | |||
550 | 549 | ||
551 | -- | This type is used to describe events triggered by 'runKeyRing'. In | 550 | -- | This type is used to describe events triggered by 'runKeyRing'. In |
552 | -- addition to normal feedback (e.g. 'NewPacket'), it also may indicate | 551 | -- addition to normal feedback (e.g. 'NewPacket'), it also may indicate |
553 | -- non-fatal IO exceptions (e.g. FailedExternal). Because a 'KeyRingOperation' | 552 | -- non-fatal IO exceptions (e.g. 'FailedExternal'). Because a |
554 | -- may describe a very intricate multifaceted algorithm with many inputs and | 553 | -- 'KeyRingOperation' may describe a very intricate multifaceted algorithm with |
555 | -- outputs, an operation may be partially (or even mostly) successful even when | 554 | -- many inputs and outputs, an operation may be partially (or even mostly) |
556 | -- some aspect failed. | 555 | -- successful even when I/O failures occured. In this situation, the files may |
556 | -- not have all the information they were intended to store, but they will be | ||
557 | -- in a valid format for GnuPG or kiki to operate on in the future. | ||
557 | data KikiReportAction = | 558 | data KikiReportAction = |
558 | NewPacket String | 559 | NewPacket String |
559 | | MissingPacket String | 560 | | MissingPacket String |
@@ -1031,8 +1032,11 @@ writeStamped0 ctx inp stamp dowrite bs = do | |||
1031 | dowrite (Right fname) bs | 1032 | dowrite (Right fname) bs |
1032 | setFileTimes fname stamp stamp | 1033 | setFileTimes fname stamp stamp |
1033 | 1034 | ||
1035 | {- This may be useful later. Commented for now, as it is not used. | ||
1036 | - | ||
1034 | writeStampedL :: InputFileContext -> InputFile -> Posix.EpochTime -> L.ByteString -> IO () | 1037 | writeStampedL :: InputFileContext -> InputFile -> Posix.EpochTime -> L.ByteString -> IO () |
1035 | writeStampedL ctx f stamp bs = writeStamped0 ctx f stamp (either L.hPut L.writeFile) bs | 1038 | writeStampedL ctx f stamp bs = writeStamped0 ctx f stamp (either L.hPut L.writeFile) bs |
1039 | -} | ||
1036 | 1040 | ||
1037 | writeStamped :: InputFileContext -> InputFile -> Posix.EpochTime -> String -> IO () | 1041 | writeStamped :: InputFileContext -> InputFile -> Posix.EpochTime -> String -> IO () |
1038 | writeStamped ctx f stamp str = writeStamped0 ctx f stamp (either hPutStr writeFile) str | 1042 | writeStamped ctx f stamp str = writeStamped0 ctx f stamp (either hPutStr writeFile) str |
@@ -1052,11 +1056,15 @@ getInputFileTime ctx (resolveInputFile ctx -> [fname]) = do | |||
1052 | handleIO_ (error $ fname++": modificaiton time?") $ | 1056 | handleIO_ (error $ fname++": modificaiton time?") $ |
1053 | modificationTime <$> getFileStatus fname | 1057 | modificationTime <$> getFileStatus fname |
1054 | 1058 | ||
1059 | {- | ||
1060 | - This may be useful later. Commented for now as it is not used. | ||
1061 | - | ||
1055 | doesInputFileExist :: InputFileContext -> InputFile -> IO Bool | 1062 | doesInputFileExist :: InputFileContext -> InputFile -> IO Bool |
1056 | doesInputFileExist ctx f = do | 1063 | doesInputFileExist ctx f = do |
1057 | case resolveInputFile ctx f of | 1064 | case resolveInputFile ctx f of |
1058 | [n] -> doesFileExist n | 1065 | [n] -> doesFileExist n |
1059 | _ -> return True | 1066 | _ -> return True |
1067 | -} | ||
1060 | 1068 | ||
1061 | 1069 | ||
1062 | cachedContents :: InputFileContext -> InputFile -> IO (IO S.ByteString) | 1070 | cachedContents :: InputFileContext -> InputFile -> IO (IO S.ByteString) |
@@ -1205,7 +1213,7 @@ buildKeyDB ctx grip0 keyring = do | |||
1205 | guard (isring $ typ stream) | 1213 | guard (isring $ typ stream) |
1206 | resolveInputFile ctx f | 1214 | resolveInputFile ctx f |
1207 | 1215 | ||
1208 | (ringMap,nonRingMap) = Map.partition (isring . typ) $ opFiles keyring | 1216 | ringMap = Map.filter (isring . typ) $ opFiles keyring |
1209 | 1217 | ||
1210 | readp f stream = fmap readp0 $ readPacketsFromFile ctx f | 1218 | readp f stream = fmap readp0 $ readPacketsFromFile ctx f |
1211 | where | 1219 | where |
@@ -1568,10 +1576,6 @@ importPublic = Just True | |||
1568 | importSecret :: Maybe Bool | 1576 | importSecret :: Maybe Bool |
1569 | importSecret = Just False | 1577 | importSecret = Just False |
1570 | 1578 | ||
1571 | -- | returns Nothing to indicate that no new master | ||
1572 | -- keys will be imported. | ||
1573 | subkeysOnly :: Maybe Bool | ||
1574 | subkeysOnly = Nothing | ||
1575 | 1579 | ||
1576 | -- TODO: Do we need to memoize this? | 1580 | -- TODO: Do we need to memoize this? |
1577 | guardAuthentic :: KeyRingRuntime -> KeyData -> Maybe () | 1581 | guardAuthentic :: KeyRingRuntime -> KeyData -> Maybe () |