summaryrefslogtreecommitdiff
path: root/lib/Transforms.hs
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-07-14 00:10:42 -0400
committerAndrew Cady <d@jerkface.net>2019-07-14 00:13:12 -0400
commitd1dce393d77121509c7ac6d729a09f9f94bc7ab7 (patch)
tree237b077c353cf5671f7821e12c59f3c11f64e585 /lib/Transforms.hs
parent3f29bdc88a068ec3eab91a8bac12757e3a106ceb (diff)
newtype UidString
Diffstat (limited to 'lib/Transforms.hs')
-rw-r--r--lib/Transforms.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Transforms.hs b/lib/Transforms.hs
index edc18bb..7750ec5 100644
--- a/lib/Transforms.hs
+++ b/lib/Transforms.hs
@@ -664,7 +664,7 @@ performManipulations doDecrypt rt wk manip = do
664 , Packet ) -- key who signed 664 , Packet ) -- key who signed
665 ] 665 ]
666 vs = do 666 vs = do
667 x <- maybeToList $ Map.lookup uid (keyUids kd) 667 x <- maybeToList $ Map.lookup (UidString uid) (keyUids kd)
668 sig <- map (packet . fst) (fst x) 668 sig <- map (packet . fst) (fst x)
669 o <- overs sig 669 o <- overs sig
670 take 1 $ do -- Stop attempting to verify after the first success. 670 take 1 $ do -- Stop attempting to verify after the first success.
@@ -681,7 +681,7 @@ performManipulations doDecrypt rt wk manip = do
681 f x = ( map ( (,Map.empty) . toMappedPacket om) (additional sigr) ++ fst x 681 f x = ( map ( (,Map.empty) . toMappedPacket om) (additional sigr) ++ fst x
682 , om `Map.union` snd x ) 682 , om `Map.union` snd x )
683 -- XXX: Shouldn't this signature generation show up in the KikiReport ? 683 -- XXX: Shouldn't this signature generation show up in the KikiReport ?
684 return $ KikiSuccess $ ( kd { keyUids = Map.adjust f uid (keyUids kd) }, report ) 684 return $ KikiSuccess $ ( kd { keyUids = Map.adjust f (UidString uid) (keyUids kd) }, report )
685 685
686 perform (kd,report) (SubKeyDeletion topk subk) = do 686 perform (kd,report) (SubKeyDeletion topk subk) = do
687 let kk = keykey $ packet $ keyMappedPacket kd 687 let kk = keykey $ packet $ keyMappedPacket kd
@@ -755,13 +755,13 @@ parseUID str = UserIDRecord {
755resolveTransform :: Transform -> KeyRingRuntime -> KeyData -> [PacketUpdate] 755resolveTransform :: Transform -> KeyRingRuntime -> KeyData -> [PacketUpdate]
756resolveTransform Autosign rt kd@(KeyData k ksigs umap submap) = ops 756resolveTransform Autosign rt kd@(KeyData k ksigs umap submap) = ops
757 where 757 where
758 ops = map (\u -> InducerSignature u []) us 758 ops = map (\(UidString u) -> InducerSignature u []) us
759 us = filter torStyle $ Map.keys umap 759 us = filter torStyle $ Map.keys umap
760 torStyle str = and [ uid_topdomain parsed == "onion" 760 torStyle (UidString str) = and [ uid_topdomain parsed == "onion"
761 , uid_realname parsed `elem` ["","Anonymous"] 761 , uid_realname parsed `elem` ["","Anonymous"]
762 , uid_user parsed == "root" 762 , uid_user parsed == "root"
763 , fmap (match . fst) (lookup (packet k) torbindings) 763 , fmap (match . fst) (lookup (packet k) torbindings)
764 == Just True ] 764 == Just True ]
765 where parsed = parseUID str 765 where parsed = parseUID str
766 match = (==subdom) . take (fromIntegral len) 766 match = (==subdom) . take (fromIntegral len)
767 subdom0 = L.fromChunks [encodeUtf8 (uid_subdomain parsed)] 767 subdom0 = L.fromChunks [encodeUtf8 (uid_subdomain parsed)]