summaryrefslogtreecommitdiff
path: root/lib/KeyRing.hs
diff options
context:
space:
mode:
authorjoe <joe@blackbird>2016-04-26 00:03:20 -0400
committerjoe <joe@blackbird>2016-04-26 00:03:20 -0400
commitc45ab3a217e90217690d19df260bbb1ed12080af (patch)
treefe45f1f68387aed48dbebda1d661bcf284fcd680 /lib/KeyRing.hs
parentae4fa8395e6c87a81681a44b549b8cbbfe82e5e1 (diff)
bugfix: don't export generated keys unless spilling.
Diffstat (limited to 'lib/KeyRing.hs')
-rw-r--r--lib/KeyRing.hs21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/KeyRing.hs b/lib/KeyRing.hs
index 8a4d870..b3dc97e 100644
--- a/lib/KeyRing.hs
+++ b/lib/KeyRing.hs
@@ -2481,14 +2481,10 @@ initializeMissingPEMFiles operation ctx grip mwk decrypt db = do
2481 2481
2482 let (missing,notmissing) = partition (\(_,_,ns,_)->null (ns >>= snd)) $ do 2482 let (missing,notmissing) = partition (\(_,_,ns,_)->null (ns >>= snd)) $ do
2483 (fname,stream) <- nonexistents 2483 (fname,stream) <- nonexistents
2484 let internalInitializer StreamInfo 2484 let mutableTag
2485 { initializer = Internal _
2486 , spill = KF_Match tag } = Just tag
2487 internalInitializer _ = Nothing
2488 mutableTag
2489 | isMutable stream = usageFromFilter (fill stream) 2485 | isMutable stream = usageFromFilter (fill stream)
2490 | otherwise = Nothing 2486 | otherwise = Nothing
2491 usage <- maybeToList $ internalInitializer stream `mplus` mutableTag 2487 usage <- maybeToList mutableTag
2492 -- TODO: Report error if generating without specifying usage tag. 2488 -- TODO: Report error if generating without specifying usage tag.
2493 let (topspec,subspec) = parseSpec (fromMaybe "" grip) usage 2489 let (topspec,subspec) = parseSpec (fromMaybe "" grip) usage
2494 -- ms will contain duplicates if a top key has multiple matching 2490 -- ms will contain duplicates if a top key has multiple matching
@@ -2539,12 +2535,19 @@ initializeMissingPEMFiles operation ctx grip mwk decrypt db = do
2539 try v $ \(db,import_rs) -> do 2535 try v $ \(db,import_rs) -> do
2540 2536
2541 -- generateInternals 2537 -- generateInternals
2542 let internals = mapMaybe getParams missing 2538 let internals = mapMaybe getParams nonexistents
2543 where 2539 where
2544 getParams (fname,subspec,ms,stream) = 2540 getParams (fname,stream) =
2545 case initializer stream of 2541 case initializer stream of
2546 Internal p -> Just (p, stream) 2542 Internal p -> do _ <- internalInitializer stream
2543 Just (p, stream)
2547 _ -> Nothing 2544 _ -> Nothing
2545
2546 internalInitializer StreamInfo
2547 { initializer = Internal _
2548 , spill = KF_Match tag } = Just tag
2549 internalInitializer _ = Nothing
2550
2548 v <- generateInternals decrypt mwk db internals 2551 v <- generateInternals decrypt mwk db internals
2549 2552
2550 try v $ \(db,internals_rs) -> do 2553 try v $ \(db,internals_rs) -> do