diff options
Diffstat (limited to 'lib/Kiki.hs')
-rw-r--r-- | lib/Kiki.hs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/Kiki.hs b/lib/Kiki.hs index a134680..25c98e2 100644 --- a/lib/Kiki.hs +++ b/lib/Kiki.hs | |||
@@ -41,6 +41,10 @@ import CommandLine | |||
41 | import KeyRing | 41 | import KeyRing |
42 | import DotLock | 42 | import DotLock |
43 | 43 | ||
44 | withAgent :: [PassphraseSpec] -> [PassphraseSpec] | ||
45 | withAgent [] = [PassphraseAgent] | ||
46 | withAgent ps = ps | ||
47 | |||
44 | ciphername Unencrypted = "-" | 48 | ciphername Unencrypted = "-" |
45 | ciphername TripleDES = "3des" | 49 | ciphername TripleDES = "3des" |
46 | ciphername (SymmetricAlgorithm w8) = "cipher-"++show w8 | 50 | ciphername (SymmetricAlgorithm w8) = "cipher-"++show w8 |
@@ -87,8 +91,8 @@ minimalOp cap = op | |||
87 | [ ( HomeSec, streaminfo { access = Sec }) | 91 | [ ( HomeSec, streaminfo { access = Sec }) |
88 | , ( HomePub, streaminfo { access = Pub }) | 92 | , ( HomePub, streaminfo { access = Pub }) |
89 | ] | 93 | ] |
90 | , opPassphrases = do pfile <- maybeToList (cap_passfd cap) | 94 | , opPassphrases = withAgent $ do pfile <- maybeToList (cap_passfd cap) |
91 | return $ PassphraseSpec Nothing Nothing pfile | 95 | return $ PassphraseSpec Nothing Nothing pfile |
92 | , opTransforms = [] | 96 | , opTransforms = [] |
93 | , opHome = cap_homespec cap | 97 | , opHome = cap_homespec cap |
94 | } | 98 | } |
@@ -155,6 +159,7 @@ importAndRefresh root cmn = do | |||
155 | ctx = InputFileContext secring pubring | 159 | ctx = InputFileContext secring pubring |
156 | passwordop = KeyRingOperation | 160 | passwordop = KeyRingOperation |
157 | { opFiles = Map.empty | 161 | { opFiles = Map.empty |
162 | -- TODO: ask agent for new passphrase | ||
158 | , opPassphrases = do pfd <- maybeToList passfd | 163 | , opPassphrases = do pfd <- maybeToList passfd |
159 | return $ PassphraseSpec Nothing Nothing pfd | 164 | return $ PassphraseSpec Nothing Nothing pfd |
160 | , opHome = homespec | 165 | , opHome = homespec |
@@ -233,16 +238,16 @@ importAndRefresh root cmn = do | |||
233 | , ( ArgFile sshcpath, (peminfo 2048 "ssh-client") ) | 238 | , ( ArgFile sshcpath, (peminfo 2048 "ssh-client") ) |
234 | , ( ArgFile sshspath, (peminfo 2048 "ssh-server") ) | 239 | , ( ArgFile sshspath, (peminfo 2048 "ssh-server") ) |
235 | ] | 240 | ] |
236 | , opPassphrases = pwds ++ do pfd <- maybeToList passfd | 241 | , opPassphrases = withAgent $ pwds ++ do pfd <- maybeToList passfd |
237 | return $ PassphraseSpec Nothing Nothing pfd | 242 | return $ PassphraseSpec Nothing Nothing pfd |
238 | , opHome = homespec | 243 | , opHome = homespec |
239 | , opTransforms = [] | 244 | , opTransforms = [] |
240 | } | 245 | } |
241 | -- doNothing = return () | 246 | -- doNothing = return () |
242 | nop = KeyRingOperation | 247 | nop = KeyRingOperation |
243 | { opFiles = Map.empty | 248 | { opFiles = Map.empty |
244 | , opPassphrases = do pfd <- maybeToList passfd | 249 | , opPassphrases = withAgent $ do pfd <- maybeToList passfd |
245 | return $ PassphraseSpec Nothing Nothing pfd | 250 | return $ PassphraseSpec Nothing Nothing pfd |
246 | , opHome=homespec, opTransforms = [] | 251 | , opHome=homespec, opTransforms = [] |
247 | } | 252 | } |
248 | -- if bUnprivileged then doNothing else mkdirFor torpath | 253 | -- if bUnprivileged then doNothing else mkdirFor torpath |