summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2015-06-23 14:32:33 -0400
committerjoe <joe@jerkface.net>2015-06-23 14:32:33 -0400
commit74aae2e664f4c7132947a415a3fb2a08bf233fb4 (patch)
treed53766dacea2c6a3cbcb04ae1fb1df43ed62bc19
parent4525b9f9a90f87fb17174ba594abbcff3df0a5d6 (diff)
Now recognizes deleted packets as file changes requring writes.
-rw-r--r--KeyRing.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index b885805..1ab819a 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -1827,12 +1827,13 @@ isauth rt keydata = dont_have keydata && maybe False (`has_good_sig` keydata) wk
1827 return $ keyPacket elm 1827 return $ keyPacket elm
1828 1828
1829writeRingKeys :: KeyRingOperation -> KeyRingRuntime -> Map.Map InputFile Message 1829writeRingKeys :: KeyRingOperation -> KeyRingRuntime -> Map.Map InputFile Message
1830 -> [(FilePath,KikiReportAction)]
1830 {- 1831 {-
1831 -> KeyDB -> Maybe Packet 1832 -> KeyDB -> Maybe Packet
1832 -> FilePath -> FilePath 1833 -> FilePath -> FilePath
1833 -} 1834 -}
1834 -> IO (KikiCondition [(FilePath,KikiReportAction)]) 1835 -> IO (KikiCondition [(FilePath,KikiReportAction)])
1835writeRingKeys krd rt {- db wk secring pubring -} unspilled = do 1836writeRingKeys krd rt {- db wk secring pubring -} unspilled report_manips = do
1836 let isring (KeyRingFile {}) = True 1837 let isring (KeyRingFile {}) = True
1837 isring _ = False 1838 isring _ = False
1838 db = rtKeyDB rt 1839 db = rtKeyDB rt
@@ -1879,7 +1880,12 @@ writeRingKeys krd rt {- db wk secring pubring -} unspilled = do
1879 _ -> flattenTop f only_public d 1880 _ -> flattenTop f only_public d
1880 new_packets = filter isnew x 1881 new_packets = filter isnew x
1881 where isnew p = isNothing (Map.lookup (resolveForReport Nothing f0) $ locations p) 1882 where isnew p = isNothing (Map.lookup (resolveForReport Nothing f0) $ locations p)
1882 guard (not $ null new_packets) 1883 -- TODO: We depend on an exact string match between the reported
1884 -- file origin of the deleted packet and the path of the file we are
1885 -- writing. Verify that this is a safe assumption.
1886 isdeleted (f',DeletedPacket _) = f'==f
1887 isdeleted _ = False
1888 guard (not (null new_packets) || any isdeleted report_manips)
1883 return ((f0,isMutable stream),(new_packets,x)) 1889 return ((f0,isMutable stream),(new_packets,x))
1884 let (towrites,report) = (\f -> foldl f ([],[]) s) $ 1890 let (towrites,report) = (\f -> foldl f ([],[]) s) $
1885 \(ws,report) ((f,mutable),(new_packets,x)) -> 1891 \(ws,report) ((f,mutable),(new_packets,x)) ->
@@ -2426,7 +2432,7 @@ runKeyRing operation = do
2426 r <- writeWalletKeys operation (rtKeyDB rt) (fmap packet wk) 2432 r <- writeWalletKeys operation (rtKeyDB rt) (fmap packet wk)
2427 try' r $ \report_wallets -> do 2433 try' r $ \report_wallets -> do
2428 2434
2429 r <- writeRingKeys operation rt unspilled 2435 r <- writeRingKeys operation rt unspilled report_manips
2430 try' r $ \report_rings -> do 2436 try' r $ \report_rings -> do
2431 2437
2432 r <- writePEMKeys decrypt (rtKeyDB rt) exports 2438 r <- writePEMKeys decrypt (rtKeyDB rt) exports