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 | |
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.
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | Gpg.hs | 4 |
2 files changed, 4 insertions, 1 deletions
@@ -7,6 +7,7 @@ keysafe (0.20160832) UNRELEASED; urgency=medium * Server-side rate limiting and DOS protection. * server: Added --months-to-fill-half-disk option, defaulting to 12. * Several new dependencies. + * Another fix to gpg secret key list parser. -- Joey Hess <id@joeyh.name> Thu, 01 Sep 2016 11:42:27 -0400 @@ -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 |