summaryrefslogtreecommitdiff
path: root/lib/GnuPGAgent.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2016-09-01 22:01:20 -0400
committerjoe <joe@jerkface.net>2016-09-01 22:01:20 -0400
commite15e036f89a2c48b762f901e063d86417345287b (patch)
tree279bf241b511589a171bc93e13916c26b140f3ef /lib/GnuPGAgent.hs
parent6734397a53e2160257a89f8c391d89ea4aa02ad4 (diff)
Password handling overhaul:
* More agressively search gpg-agent cache. * Allow key-specific passphrase fds.
Diffstat (limited to 'lib/GnuPGAgent.hs')
-rw-r--r--lib/GnuPGAgent.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/GnuPGAgent.hs b/lib/GnuPGAgent.hs
index 067e3bc..9e0bacf 100644
--- a/lib/GnuPGAgent.hs
+++ b/lib/GnuPGAgent.hs
@@ -3,6 +3,7 @@
3{-# LANGUAGE PatternGuards #-} 3{-# LANGUAGE PatternGuards #-}
4module GnuPGAgent 4module GnuPGAgent
5 ( session 5 ( session
6 , GnuPGAgent
6 , Query(..) 7 , Query(..)
7 , QueryMode(..) 8 , QueryMode(..)
8 , getPassphrase 9 , getPassphrase
@@ -99,7 +100,8 @@ getPassphrase agent ask (Query key uid masterkey) = do
99 r0 <- hGetLine (agentHandle agent) 100 r0 <- hGetLine (agentHandle agent)
100 -- hPutStrLn stderr $ "agent says: " ++ r0 101 -- hPutStrLn stderr $ "agent says: " ++ r0
101 case takeWhile (/=' ') r0 of 102 case takeWhile (/=' ') r0 of
102 "OK" -> hGetLine (agentHandle agent) >>= unhex . drop 3 103 "OK" | not (null $ drop 3 r0) -> return r0 >>= unhex . drop 3 -- . (\x -> trace (show x) x)
104 | otherwise -> hGetLine (agentHandle agent) >>= unhex . drop 3 -- . (\x -> trace (show x) x)
103 where 105 where
104#if defined(VERSION_memory) 106#if defined(VERSION_memory)
105 unhex hx = case convertFromBase Base16 (S8.pack hx) of 107 unhex hx = case convertFromBase Base16 (S8.pack hx) of