diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-09-14 13:25:12 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-09-14 13:25:55 -0400 |
commit | 8d1185c3884f8125cedf9c4c8060cb5d360e9ef4 (patch) | |
tree | 98c4d23ffcd5a316f397b5d9fb0d61d4bac2a888 /Gpg.hs | |
parent | 57a3a1725f93541f8eb6ddbdeb429fbc37bb4025 (diff) | |
download | keysafe-8d1185c3884f8125cedf9c4c8060cb5d360e9ef4.tar.gz |
Another fix to gpg secret key list parser.
gpg2 2.1.15 seems to have added some new fields to the --with-colons
--list-secret-keys output. These include "fpr" and "grp", and come before
the "uid" line. So, the parser was giving up before it saw the name. Fix by
continueing to look for the uid line until the next "sec" line.
Diffstat (limited to 'Gpg.hs')
-rw-r--r-- | Gpg.hs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -42,8 +42,10 @@ listSecretKeys = map mk . parse . lines <$> readProcess "gpg" parse = extract [] Nothing . map (splitOn ":") extract c (Just keyid) (("uid":_:_:_:_:_:_:_:_:userid:_):rest) = extract ((userid, keyid):c) Nothing rest - extract c (Just keyid) rest = + extract c (Just keyid) rest@(("sec":_):_) = extract (("", keyid):c) Nothing rest + extract c (Just keyid) (_:rest) = + extract c (Just keyid) rest extract c _ [] = c extract c _ (("sec":_:_:_:keyid:_):rest) = extract c (Just keyid) rest |