summaryrefslogtreecommitdiff
path: root/lib/KeyRing/BuildKeyDB.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/KeyRing/BuildKeyDB.hs')
-rw-r--r--lib/KeyRing/BuildKeyDB.hs23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs
index 9a806a3..f90f638 100644
--- a/lib/KeyRing/BuildKeyDB.hs
+++ b/lib/KeyRing/BuildKeyDB.hs
@@ -132,7 +132,7 @@ buildKeyDB :: InputFileContext -> Maybe String -> KeyRingOperation
132 ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts], 132 ,{- hs -} ({- hostdbs0 -}[Hosts.Hosts],
133 {- hostdbs -}[Hosts.Hosts], 133 {- hostdbs -}[Hosts.Hosts],
134 {- u1 -}Hosts.Hosts, 134 {- u1 -}Hosts.Hosts,
135 {- gpgnames -}[(SockAddr, ([ByteString],[ByteString]))], 135 {- gpgnames -}[Hostnames],
136 {- outgoing_names -}[SockAddr]) 136 {- outgoing_names -}[SockAddr])
137 ,{- accs -} Map.Map InputFile Access 137 ,{- accs -} Map.Map InputFile Access
138 ,{- transcode -} PacketTranscoder 138 ,{- transcode -} PacketTranscoder
@@ -564,7 +564,7 @@ mergeHostFiles :: KeyRingOperation -> KeyDB -> InputFileContext
564 , ( [Hosts.Hosts] 564 , ( [Hosts.Hosts]
565 , [Hosts.Hosts] 565 , [Hosts.Hosts]
566 , Hosts.Hosts 566 , Hosts.Hosts
567 , [(SockAddr, ([Char8.ByteString], [Char8.ByteString]))] 567 , [Hostnames]
568 , [SockAddr])) 568 , [SockAddr]))
569 , [(FilePath,KikiReportAction)])) 569 , [(FilePath,KikiReportAction)]))
570mergeHostFiles krd db ctx = do 570mergeHostFiles krd db ctx = do
@@ -586,14 +586,14 @@ mergeHostFiles krd db ctx = do
586 586
587 let gpgnames = map getHostnames $ Map.elems db 587 let gpgnames = map getHostnames $ Map.elems db
588 os = do 588 os = do
589 (addr,(ns,_)) <- gpgnames 589 Hostnames addr ns _ _ <- gpgnames
590 n <- ns 590 n <- ns
591 return (addr,n) 591 return (addr,n)
592 setOnions hosts = foldl' (flip $ uncurry Hosts.assignName) hosts os 592 setOnions hosts = foldl' (flip $ uncurry Hosts.assignName) hosts os
593 -- we ensure .onion names are set properly 593 -- we ensure .onion names are set properly
594 hostdbs = map setOnions hostdbs0 594 hostdbs = map setOnions hostdbs0
595 outgoing_names = do 595 outgoing_names = do
596 (addr,(_,gns)) <- gpgnames 596 Hostnames addr _ gns _ <- gpgnames
597 guard . not $ null gns 597 guard . not $ null gns
598 guard $ all (null . Hosts.namesForAddress addr) hostdbs0 598 guard $ all (null . Hosts.namesForAddress addr) hostdbs0
599 return addr 599 return addr
@@ -902,13 +902,20 @@ generateSubkey transcode kd' (genparam,StreamInfo { spill = KF_Match tag }) = do
902 return $ KikiSuccess (kd,report0) 902 return $ KikiSuccess (kd,report0)
903generateSubkey _ kd _ = return kd 903generateSubkey _ kd _ = return kd
904 904
905data Hostnames = Hostnames {
906 gpgipv6addr :: SockAddr,
907 verifiedOnionNames :: [L.ByteString],
908 notationPacketNames :: [L.ByteString],
909 cryptonomicName :: Maybe L.ByteString
910}
911
905-- | 912-- |
906-- Returns (ip6 fingerprint address,(onion names,other host names)) 913-- Returns (ip6 fingerprint address,(onion names,other host names))
907-- 914--
908-- Requires a validly cross-signed tor key for each onion name returned. 915-- Requires a validly cross-signed tor key for each onion name returned.
909-- (Signature checks are performed.) 916-- (Signature checks are performed.)
910getHostnames :: KeyData -> (SockAddr, ([L.ByteString],[L.ByteString])) 917getHostnames :: KeyData -> Hostnames
911getHostnames (KeyData topmp _ uids subs) = (addr,(onames,othernames)) 918getHostnames (KeyData topmp _ uids subs) = Hostnames addr onames othernames Nothing
912 where 919 where
913 othernames = do 920 othernames = do
914 mp <- flattenAllUids "" True uids 921 mp <- flattenAllUids "" True uids
@@ -966,7 +973,9 @@ setHostnames pred hosts kd@(KeyData topmp topsigs uids subs) =
966 addr = fingerdress topk 973 addr = fingerdress topk
967 names :: [Char8.ByteString] 974 names :: [Char8.ByteString]
968 names = Hosts.namesForAddress addr hosts 975 names = Hosts.namesForAddress addr hosts
969 (_, (gotOnions, gotNonOnions)) = getHostnames kd 976
977 Hostnames _ gotOnions gotNonOnions cryptonomic = getHostnames kd
978
970 namesWithoutGotOnions = names \\ gotOnions 979 namesWithoutGotOnions = names \\ gotOnions
971 notations = map (NotationDataPacket True "hostname@" . Char8.unpack) namesWithoutGotOnions 980 notations = map (NotationDataPacket True "hostname@" . Char8.unpack) namesWithoutGotOnions
972 isName (NotationDataPacket True "hostname@" _) = True 981 isName (NotationDataPacket True "hostname@" _) = True