summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-04-21 01:28:07 -0400
committerjoe <joe@jerkface.net>2014-04-21 01:28:07 -0400
commit987472cadc9823d8e76f13dbcf4358b5cf57f6fa (patch)
tree5c99165d1f9b2202395b063d8c0c9ccc57fcbf30
parentba3249708c52d0c5cf85ed5eb13dd7191b6b990b (diff)
Don't write hosts files that are not marked mutable
-rw-r--r--KeyRing.hs10
-rw-r--r--kiki.hs3
2 files changed, 8 insertions, 5 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index c6aa6a4..653a76d 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -760,12 +760,12 @@ writeHostsFiles
760 [SockAddr]) 760 [SockAddr])
761 -> IO [(FilePath, KikiReportAction)] 761 -> IO [(FilePath, KikiReportAction)]
762writeHostsFiles krd secring pubring (hostdbs0,hostdbs,u1,gpgnames,outgoing_names) = do 762writeHostsFiles krd secring pubring (hostdbs0,hostdbs,u1,gpgnames,outgoing_names) = do
763 let hns = files ishosts 763 let hns = files isMutableHosts
764 ishosts Hosts = True 764 isMutableHosts (MutableRef _,Hosts) = True
765 ishosts _ = False 765 isMutableHosts _ = False
766 files istyp = do 766 files istyp = do
767 (f,(rtyp,ftyp)) <- Map.toList (kFiles krd) 767 (f,typ) <- Map.toList (kFiles krd)
768 guard (istyp ftyp) 768 guard (istyp typ)
769 resolveInputFile secring pubring f 769 resolveInputFile secring pubring f
770 770
771 -- 3. add hostnames from gpg for addresses not in U 771 -- 3. add hostnames from gpg for addresses not in U
diff --git a/kiki.hs b/kiki.hs
index 60c0b6b..0d87b90 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -1136,6 +1136,8 @@ main = do
1136 wallets 1136 wallets
1137 rings = map (\fname -> (ArgFile fname, (MutableRef Nothing, KeyRingFile passfd))) 1137 rings = map (\fname -> (ArgFile fname, (MutableRef Nothing, KeyRingFile passfd)))
1138 keyrings_ 1138 keyrings_
1139 hosts = maybe [] (map decorate) $ Map.lookup "--hosts" margs
1140 where decorate fname = (ArgFile fname, (MutableRef Nothing, Hosts))
1139 importStyle = maybe (\_ _ -> subkeysOnly) 1141 importStyle = maybe (\_ _ -> subkeysOnly)
1140 (\f rt kd -> f rt kd >> importPublic) 1142 (\f rt kd -> f rt kd >> importPublic)
1141 $ mplus import_f importifauth_f 1143 $ mplus import_f importifauth_f
@@ -1152,6 +1154,7 @@ main = do
1152 ++ rings 1154 ++ rings
1153 ++ pems 1155 ++ pems
1154 ++ walts 1156 ++ walts
1157 ++ hosts
1155 , kImports = Map.fromList $ 1158 , kImports = Map.fromList $
1156 [ ( HomePub, importStyle ) ] 1159 [ ( HomePub, importStyle ) ]
1157 , kManip = noManip 1160 , kManip = noManip