From e15e036f89a2c48b762f901e063d86417345287b Mon Sep 17 00:00:00 2001 From: joe Date: Thu, 1 Sep 2016 22:01:20 -0400 Subject: Password handling overhaul: * More agressively search gpg-agent cache. * Allow key-specific passphrase fds. --- lib/GnuPGAgent.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/GnuPGAgent.hs') 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 @@ {-# LANGUAGE PatternGuards #-} module GnuPGAgent ( session + , GnuPGAgent , Query(..) , QueryMode(..) , getPassphrase @@ -99,7 +100,8 @@ getPassphrase agent ask (Query key uid masterkey) = do r0 <- hGetLine (agentHandle agent) -- hPutStrLn stderr $ "agent says: " ++ r0 case takeWhile (/=' ') r0 of - "OK" -> hGetLine (agentHandle agent) >>= unhex . drop 3 + "OK" | not (null $ drop 3 r0) -> return r0 >>= unhex . drop 3 -- . (\x -> trace (show x) x) + | otherwise -> hGetLine (agentHandle agent) >>= unhex . drop 3 -- . (\x -> trace (show x) x) where #if defined(VERSION_memory) unhex hx = case convertFromBase Base16 (S8.pack hx) of -- cgit v1.2.3