summaryrefslogtreecommitdiff
path: root/lib/KeyRing
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-07-07 16:32:56 -0400
committerAndrew Cady <d@jerkface.net>2019-07-07 16:32:56 -0400
commit0efeea061f1aaad7ee60162f0502c4e445489d3b (patch)
tree3dfead6b06031fa44c8707571f71eb1bc9fa1fbf /lib/KeyRing
parentea1dfdcde779eef733c983a00826b6f0a7523e73 (diff)
trying to clarify setHostnames
Diffstat (limited to 'lib/KeyRing')
-rw-r--r--lib/KeyRing/BuildKeyDB.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/KeyRing/BuildKeyDB.hs b/lib/KeyRing/BuildKeyDB.hs
index f90f638..6e62e70 100644
--- a/lib/KeyRing/BuildKeyDB.hs
+++ b/lib/KeyRing/BuildKeyDB.hs
@@ -617,7 +617,7 @@ mergeHostFiles krd db ctx = do
617 617
618 -- 2. replace gpg annotations with those in U 618 -- 2. replace gpg annotations with those in U
619 -- forM use_db 619 -- forM use_db
620 db' <- Traversable.mapM (setHostnames (`notElem` outgoing_names) u1) db 620 db' <- Traversable.mapM (setHostnames outgoing_names u1) db
621 621
622 return $ KikiSuccess ((db',(hostdbs0,hostdbs,u1,gpgnames,outgoing_names)),[]) 622 return $ KikiSuccess ((db',(hostdbs0,hostdbs,u1,gpgnames,outgoing_names)),[])
623 623
@@ -947,13 +947,13 @@ hasFingerDress db addr = pre=="fd" && isJust (selectPublicKey (KeyGrip g',Nothin
947 g' = map toUpper g 947 g' = map toUpper g
948 948
949-- We return into IO in case we want to make a signature here. 949-- We return into IO in case we want to make a signature here.
950setHostnames :: (SockAddr -> Bool) -> Hosts.Hosts -> KeyData -> IO KeyData 950setHostnames :: [SockAddr] -> Hosts.Hosts -> KeyData -> IO KeyData
951setHostnames pred hosts kd@(KeyData topmp topsigs uids subs) = 951setHostnames outgoing_names hosts kd@(KeyData topmp topsigs uids subs) =
952 -- TODO: we are removing the origin from the UID OriginMap, 952 -- TODO: we are removing the origin from the UID OriginMap,
953 -- when we should be removing origins from the locations 953 -- when we should be removing origins from the locations
954 -- field of the sig's MappedPacket records. 954 -- field of the sig's MappedPacket records.
955 -- Call getHostnames and compare to see if no-op. 955 -- Call getHostnames and compare to see if no-op.
956 if not (pred addr) || gotNonOnions == namesWithoutGotOnions 956 if pred || pred2
957 then {- trace (unlines [ "setHostnames NO-OP: gpg: "++show (map Char8.unpack onions, map Char8.unpack names0) 957 then {- trace (unlines [ "setHostnames NO-OP: gpg: "++show (map Char8.unpack onions, map Char8.unpack names0)
958 , " file: "++show (map Char8.unpack names) 958 , " file: "++show (map Char8.unpack names)
959 , " pred: "++show (pred addr)]) -} 959 , " pred: "++show (pred addr)]) -}
@@ -969,10 +969,12 @@ setHostnames pred hosts kd@(KeyData topmp topsigs uids subs) =
969 -} 969 -}
970 return $ KeyData topmp topsigs uids1 subs 970 return $ KeyData topmp topsigs uids1 subs
971 where 971 where
972 pred = addr `elem` outgoing_names
972 topk = packet topmp 973 topk = packet topmp
973 addr = fingerdress topk 974 addr = fingerdress topk
974 names :: [Char8.ByteString] 975 names :: [Char8.ByteString]
975 names = Hosts.namesForAddress addr hosts 976 names = Hosts.namesForAddress addr hosts
977 pred2 = gotNonOnions == namesWithoutGotOnions
976 978
977 Hostnames _ gotOnions gotNonOnions cryptonomic = getHostnames kd 979 Hostnames _ gotOnions gotNonOnions cryptonomic = getHostnames kd
978 980